* Performance gcj & mysql
@ 2008-09-08 16:09 ezer
2008-09-08 16:18 ` Andrew Haley
0 siblings, 1 reply; 9+ messages in thread
From: ezer @ 2008-09-08 16:09 UTC (permalink / raw)
To: java
I am making a simple test to compare the performance of connection and
execution of an sql query compiling with java sun and gcj
The examples connect, and collect the results on a vector and exit.
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
public class MysqlConnect{
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
System.out.println("MySQL Connect Example.");
Connection conn = null;
String dbName = "mysql";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "admin";
List rows = new ArrayList();
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName(driver).newInstance();
conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysqltest?useJvmCharsetConverters=true&useOldUTF8Behavior=true",
userName, password);
System.out.println("Connected to the database");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT id, titulo, descripcion FROM mytable");
System.out.println("Query executed");
while (rs.next()) {
//System.out.println(rs.getInt("id") + ", " + rs.getString("titulo") +
", " + rs.getString("descripcion"));
Vector row = new Vector();
row.add(rs.getInt("id"));
row.add(rs.getString("titulo"));
row.add(rs.getString("descripcion"));
rows.add(row);
}
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
long stopTime = System.currentTimeMillis();
long elapsedTime = (stopTime - startTime) / 1000;
System.out.println("Execution Time: " + elapsedTime + " seconds");
}
}
Testing with JVM:
-----------------
>java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
>javac -Xlint MysqlConnect.java
>java MysqlConnect
MySQL Connect Example.
Connected to the database
Query executed
Disconnected from database
Execution Time: 3 seconds
Testing with GCJ:
-----------------
>gcj --version
>gcj (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu6)
>gcj --main=MysqlConnect -o mysqlconnect MysqlConnect.java mysql-5.0.8.o
>./mysqlconnect
MySQL Connect Example.
Connected to the database
Query executed
Disconnected from database
Execution Time: 9 seconds
Testing with GCJ-4.3:
-----------------
>gcj-4.3 --version
>gcj-4.3 (Ubuntu 4.3.2-1ubuntu1) 4.3.2
>gcj-4.3 --main=MysqlConnect -o mysqlconnect MysqlConnect.java mysql-5.0.8.o
>./mysqlconnect
MySQL Connect Example.
Connected to the database
Query executed
Disconnected from database
Execution Time: 9 seconds
QUESTIONS:
------------
1) How can i improve performance to do it better than jvm ?
2) ./mysqlconnect stays dependant of the gcj libraries? When i uninstall gcj
the executable complains about libgcj. Is there any way to have it totally
independent, for example i want to copy the executable and mysql-5.0.8.o
library without worring if have have gcj installed on that machine.
--
View this message in context: http://www.nabble.com/Performance-gcj---mysql-tp19375453p19375453.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-08 16:09 Performance gcj & mysql ezer
@ 2008-09-08 16:18 ` Andrew Haley
2008-09-08 17:55 ` Marco Trudel
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2008-09-08 16:18 UTC (permalink / raw)
To: ezer; +Cc: java
ezer wrote:
> 1) How can i improve performance to do it better than jvm ?
Huh? Which JVM? If the answer is some all-singing high-performance
JIT, then you can't.
> 2) ./mysqlconnect stays dependant of the gcj libraries? When i uninstall gcj
> the executable complains about libgcj. Is there any way to have it totally
> independent, for example i want to copy the executable and mysql-5.0.8.o
> library without worring if have have gcj installed on that machine.
This is very difficult. The -static-libgcj option might help,
but I wouldn't guarantee it. For more details see:
http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
Andrew.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-08 16:18 ` Andrew Haley
@ 2008-09-08 17:55 ` Marco Trudel
2008-09-08 18:27 ` Andrew Haley
2008-09-09 13:11 ` ezer
0 siblings, 2 replies; 9+ messages in thread
From: Marco Trudel @ 2008-09-08 17:55 UTC (permalink / raw)
To: Andrew Haley; +Cc: ezer, java
Andrew Haley wrote:
> ezer wrote:
>
>> 1) How can i improve performance to do it better than jvm ?
>
> Huh? Which JVM? If the answer is some all-singing high-performance
> JIT, then you can't.
Well, enabling optimization might be a start. Try adding "-O2" or "-O3"
to your compilation command.
>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i uninstall gcj
>> the executable complains about libgcj. Is there any way to have it totally
>> independent, for example i want to copy the executable and mysql-5.0.8.o
>> library without worring if have have gcj installed on that machine.
>
> This is very difficult. The -static-libgcj option might help,
> but I wouldn't guarantee it. For more details see:
> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
Actually it works quite well as long as you know some little details.
Just ask if you run into problems...
Marco
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-08 17:55 ` Marco Trudel
@ 2008-09-08 18:27 ` Andrew Haley
2008-09-11 18:56 ` ezer
2008-09-09 13:11 ` ezer
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2008-09-08 18:27 UTC (permalink / raw)
To: Marco Trudel; +Cc: ezer, java
Marco Trudel wrote:
> Andrew Haley wrote:
>>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i
>>> uninstall gcj
>>> the executable complains about libgcj. Is there any way to have it
>>> totally
>>> independent, for example i want to copy the executable and mysql-5.0.8.o
>>> library without worring if have have gcj installed on that machine.
>>
>> This is very difficult. The -static-libgcj option might help,
>> but I wouldn't guarantee it. For more details see:
>> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
>
> Actually it works quite well as long as you know some little details.
Well, no. It can work in some circumstances, and in others it doesn't
work at all.
Andrew.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-08 17:55 ` Marco Trudel
2008-09-08 18:27 ` Andrew Haley
@ 2008-09-09 13:11 ` ezer
1 sibling, 0 replies; 9+ messages in thread
From: ezer @ 2008-09-09 13:11 UTC (permalink / raw)
To: java
Thanks Marco,
I tryed with -O2 , -O3, -O6 etc and the result is the same.
When i run gcj-4.3 -static-libgcj --main=MysqlConnect -o mysqlconnect
MysqlConnect.java mysql-5.0.8.o
i get:
/usr/bin/ld: cannot find -lgcj
collect2: ld returned 1 exit status
Marco Trudel-4 wrote:
>
> Andrew Haley wrote:
>> ezer wrote:
>>
>>> 1) How can i improve performance to do it better than jvm ?
>>
>> Huh? Which JVM? If the answer is some all-singing high-performance
>> JIT, then you can't.
>
> Well, enabling optimization might be a start. Try adding "-O2" or "-O3"
> to your compilation command.
>
>>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i uninstall
>>> gcj
>>> the executable complains about libgcj. Is there any way to have it
>>> totally
>>> independent, for example i want to copy the executable and mysql-5.0.8.o
>>> library without worring if have have gcj installed on that machine.
>>
>> This is very difficult. The -static-libgcj option might help,
>> but I wouldn't guarantee it. For more details see:
>> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
>
> Actually it works quite well as long as you know some little details.
> Just ask if you run into problems...
>
>
> Marco
>
>
--
View this message in context: http://www.nabble.com/Performance-gcj---mysql-tp19375453p19392027.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-08 18:27 ` Andrew Haley
@ 2008-09-11 18:56 ` ezer
2008-09-12 8:02 ` Marco Trudel
0 siblings, 1 reply; 9+ messages in thread
From: ezer @ 2008-09-11 18:56 UTC (permalink / raw)
To: java
I run gcj -static-libgcj --main=MysqlConnect -o mysqlconnect
MysqlConnect.java mysql-5.0.8.o
i get:
/usr/bin/ld: cannot find -lgcj
collect2: ld returned 1 exit status
The file libgcj.spec :
%rename startfile startfileorig
*startfile: %(startfileorig)
%rename lib liborig
*lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-lgcj}
%{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
%(liborig)
*jc1: -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc
-fnon-call-exceptions -fkeep-inline-functions
I cant find any lgcj file, i found libgcj, even changing the names i get the
same error. Sghould i define a path or add any other file ?
Andrew Haley wrote:
>
> Marco Trudel wrote:
>> Andrew Haley wrote:
>
>>>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i
>>>> uninstall gcj
>>>> the executable complains about libgcj. Is there any way to have it
>>>> totally
>>>> independent, for example i want to copy the executable and
>>>> mysql-5.0.8.o
>>>> library without worring if have have gcj installed on that machine.
>>>
>>> This is very difficult. The -static-libgcj option might help,
>>> but I wouldn't guarantee it. For more details see:
>>> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
>>
>> Actually it works quite well as long as you know some little details.
>
> Well, no. It can work in some circumstances, and in others it doesn't
> work at all.
>
> Andrew.
>
>
--
View this message in context: http://www.nabble.com/Performance-gcj---mysql-tp19375453p19441905.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-11 18:56 ` ezer
@ 2008-09-12 8:02 ` Marco Trudel
2008-09-15 14:24 ` ezer
0 siblings, 1 reply; 9+ messages in thread
From: Marco Trudel @ 2008-09-12 8:02 UTC (permalink / raw)
To: ezer; +Cc: java
ezer wrote:
>
> I run gcj -static-libgcj --main=MysqlConnect -o mysqlconnect
> MysqlConnect.java mysql-5.0.8.o
>
> i get:
> /usr/bin/ld: cannot find -lgcj
> collect2: ld returned 1 exit status
>
> The file libgcj.spec :
Right, now I remember. This one has already been discussed long ago. I
even had a local patch to fix it for testing purposes...
I think my conclusion back then was that libgcj.spec was/is flawed for
using "-static-libgcj". But the discussion was - if I remember right -
somewhat strange and Andrew didn't agree with that. One of the
discussions about libgcj.spec can be found here:
http://gcc.gnu.org/ml/java/2007-03/msg00074.html
But I think it's not really the discussion I have in mind.
Anyway, you need to adjust that file. Just try temporarily removing
"-lgcj"...
Hope that helps
Marco
> %rename startfile startfileorig
> *startfile: %(startfileorig)
>
> %rename lib liborig
> *lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-lgcj}
> %{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
> %(liborig)
>
> *jc1: -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc
> -fnon-call-exceptions -fkeep-inline-functions
>
>
> I cant find any lgcj file, i found libgcj, even changing the names i get the
> same error. Sghould i define a path or add any other file ?
>
>
>
> Andrew Haley wrote:
>> Marco Trudel wrote:
>>> Andrew Haley wrote:
>>>>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i
>>>>> uninstall gcj
>>>>> the executable complains about libgcj. Is there any way to have it
>>>>> totally
>>>>> independent, for example i want to copy the executable and
>>>>> mysql-5.0.8.o
>>>>> library without worring if have have gcj installed on that machine.
>>>> This is very difficult. The -static-libgcj option might help,
>>>> but I wouldn't guarantee it. For more details see:
>>>> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
>>> Actually it works quite well as long as you know some little details.
>> Well, no. It can work in some circumstances, and in others it doesn't
>> work at all.
>>
>> Andrew.
>>
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-12 8:02 ` Marco Trudel
@ 2008-09-15 14:24 ` ezer
2008-09-17 18:25 ` ezer
0 siblings, 1 reply; 9+ messages in thread
From: ezer @ 2008-09-15 14:24 UTC (permalink / raw)
To: java
i substituded the line
%rename lib liborig
*lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-libgcj}
%{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
%(liborig)
to:
%rename lib liborig
*lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc}
%{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
%(liborig)
and i get a very ñlarge stack of error.. a little part of that is:
mysql-5.0.8.o: In function `void com::mysql::jdbc::Statement::cancel()':
mysql-connector-java-5.0.8-bin.jar:(.text+0xb0b48): undefined reference to
`_Jv_MonitorEnter'
mysql-connector-java-5.0.8-bin.jar:(.text+0xb0b87): undefined reference to
`_Jv_AllocObjectNoFinalizer'
mysql-connector-java-5.0.8-bin.jar:(.text+0xb0c24): undefined reference to
`_Jv_LookupInterfaceMethodIdx'
I also tried
%{s-bc-abi:-lgcj_bc;:-lgcj_bc}
and it complains about -lgcj_bc (/usr/bin/ld: cannot find-lgcj_bc )
Is not any little step by step tutorial of requirements ? paths, required
libs, etc. Any tested environment, perhups i could run any other distro of
linux, not ubuntu. I think the thinks i am trying to do are very basic
things.. dont believe that anybody passed by the same problems than I.
Marco Trudel-4 wrote:
>
> ezer wrote:
>>
>> I run gcj -static-libgcj --main=MysqlConnect -o mysqlconnect
>> MysqlConnect.java mysql-5.0.8.o
>>
>> i get:
>> /usr/bin/ld: cannot find -lgcj
>> collect2: ld returned 1 exit status
>>
>> The file libgcj.spec :
>
> Right, now I remember. This one has already been discussed long ago. I
> even had a local patch to fix it for testing purposes...
> I think my conclusion back then was that libgcj.spec was/is flawed for
> using "-static-libgcj". But the discussion was - if I remember right -
> somewhat strange and Andrew didn't agree with that. One of the
> discussions about libgcj.spec can be found here:
> http://gcc.gnu.org/ml/java/2007-03/msg00074.html
> But I think it's not really the discussion I have in mind.
>
> Anyway, you need to adjust that file. Just try temporarily removing
> "-lgcj"...
>
>
> Hope that helps
> Marco
>
>
>> %rename startfile startfileorig
>> *startfile: %(startfileorig)
>>
>> %rename lib liborig
>> *lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-lgcj}
>> %{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
>> %(liborig)
>>
>> *jc1: -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc
>> -fnon-call-exceptions -fkeep-inline-functions
>>
>>
>> I cant find any lgcj file, i found libgcj, even changing the names i get
>> the
>> same error. Sghould i define a path or add any other file ?
>>
>>
>>
>> Andrew Haley wrote:
>>> Marco Trudel wrote:
>>>> Andrew Haley wrote:
>>>>>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i
>>>>>> uninstall gcj
>>>>>> the executable complains about libgcj. Is there any way to have it
>>>>>> totally
>>>>>> independent, for example i want to copy the executable and
>>>>>> mysql-5.0.8.o
>>>>>> library without worring if have have gcj installed on that machine.
>>>>> This is very difficult. The -static-libgcj option might help,
>>>>> but I wouldn't guarantee it. For more details see:
>>>>> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
>>>> Actually it works quite well as long as you know some little details.
>>> Well, no. It can work in some circumstances, and in others it doesn't
>>> work at all.
>>>
>>> Andrew.
>>>
>>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/Performance-gcj---mysql-tp19375453p19494005.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Performance gcj & mysql
2008-09-15 14:24 ` ezer
@ 2008-09-17 18:25 ` ezer
0 siblings, 0 replies; 9+ messages in thread
From: ezer @ 2008-09-17 18:25 UTC (permalink / raw)
To: java
i downloaded a virtual appliance of debian etch with basic functionalities
to run with vmware.
installed gcj by the synaptic package manager
and also cant use -static-libgcj :
/usr/bin/ld: cannot find -lgcj
Wich files should i install to a machine that soesnt have gcj to run a
compiled program without using static compilation
ezer wrote:
>
> i substituded the line
>
> %rename lib liborig
> *lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-libgcj}
> %{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
> %(liborig)
>
> to:
>
> %rename lib liborig
> *lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc}
> %{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
> %(liborig)
>
> and i get a very ñlarge stack of error.. a little part of that is:
>
> mysql-5.0.8.o: In function `void com::mysql::jdbc::Statement::cancel()':
> mysql-connector-java-5.0.8-bin.jar:(.text+0xb0b48): undefined reference to
> `_Jv_MonitorEnter'
> mysql-connector-java-5.0.8-bin.jar:(.text+0xb0b87): undefined reference to
> `_Jv_AllocObjectNoFinalizer'
> mysql-connector-java-5.0.8-bin.jar:(.text+0xb0c24): undefined reference to
> `_Jv_LookupInterfaceMethodIdx'
>
>
> I also tried
> %{s-bc-abi:-lgcj_bc;:-lgcj_bc}
> and it complains about -lgcj_bc (/usr/bin/ld: cannot find-lgcj_bc )
>
> Is not any little step by step tutorial of requirements ? paths, required
> libs, etc. Any tested environment, perhups i could run any other distro of
> linux, not ubuntu. I think the thinks i am trying to do are very basic
> things.. dont believe that anybody passed by the same problems than I.
>
>
> Marco Trudel-4 wrote:
>>
>> ezer wrote:
>>>
>>> I run gcj -static-libgcj --main=MysqlConnect -o mysqlconnect
>>> MysqlConnect.java mysql-5.0.8.o
>>>
>>> i get:
>>> /usr/bin/ld: cannot find -lgcj
>>> collect2: ld returned 1 exit status
>>>
>>> The file libgcj.spec :
>>
>> Right, now I remember. This one has already been discussed long ago. I
>> even had a local patch to fix it for testing purposes...
>> I think my conclusion back then was that libgcj.spec was/is flawed for
>> using "-static-libgcj". But the discussion was - if I remember right -
>> somewhat strange and Andrew didn't agree with that. One of the
>> discussions about libgcj.spec can be found here:
>> http://gcc.gnu.org/ml/java/2007-03/msg00074.html
>> But I think it's not really the discussion I have in mind.
>>
>> Anyway, you need to adjust that file. Just try temporarily removing
>> "-lgcj"...
>>
>>
>> Hope that helps
>> Marco
>>
>>
>>> %rename startfile startfileorig
>>> *startfile: %(startfileorig)
>>>
>>> %rename lib liborig
>>> *lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-lgcj}
>>> %{static-libgcj:-call_shared} -lm -lpthread -lrt -lz -ldl %(libgcc)
>>> %(liborig)
>>>
>>> *jc1: -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc
>>> -fnon-call-exceptions -fkeep-inline-functions
>>>
>>>
>>> I cant find any lgcj file, i found libgcj, even changing the names i get
>>> the
>>> same error. Sghould i define a path or add any other file ?
>>>
>>>
>>>
>>> Andrew Haley wrote:
>>>> Marco Trudel wrote:
>>>>> Andrew Haley wrote:
>>>>>>> 2) ./mysqlconnect stays dependant of the gcj libraries? When i
>>>>>>> uninstall gcj
>>>>>>> the executable complains about libgcj. Is there any way to have it
>>>>>>> totally
>>>>>>> independent, for example i want to copy the executable and
>>>>>>> mysql-5.0.8.o
>>>>>>> library without worring if have have gcj installed on that machine.
>>>>>> This is very difficult. The -static-libgcj option might help,
>>>>>> but I wouldn't guarantee it. For more details see:
>>>>>> http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
>>>>> Actually it works quite well as long as you know some little details.
>>>> Well, no. It can work in some circumstances, and in others it doesn't
>>>> work at all.
>>>>
>>>> Andrew.
>>>>
>>>>
>>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Performance-gcj---mysql-tp19375453p19538278.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-09-17 18:25 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-08 16:09 Performance gcj & mysql ezer
2008-09-08 16:18 ` Andrew Haley
2008-09-08 17:55 ` Marco Trudel
2008-09-08 18:27 ` Andrew Haley
2008-09-11 18:56 ` ezer
2008-09-12 8:02 ` Marco Trudel
2008-09-15 14:24 ` ezer
2008-09-17 18:25 ` ezer
2008-09-09 13:11 ` ezer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).