Ceylon performance

210 views
Skip to first unread message

Alexander Kornilov

unread,
Dec 18, 2017, 6:09:56 AM12/18/17
to ceylon-users
Hi, all!

I have performed comparison in the performance aspect of languages which I am interested in.
I had not enough time to test separate subsystem of each language, so I made decision prepare the console application on each one (same classes and logic):
+ Intensive I/O
+ Float arithmetic: sin, cos, sqrt etc
+ Collections: Map and Array.

I have huge text files from previous project with cartographic data.
All test applications should:
1) To filter files by extension from specified through command line from directory.
2) To process all text files line by line.
3) To parse each line and extract information about all map segments. Each segment has start and end position.
4) To filter segments by distance by specified point and put it into the Map by segment identifer to have segments group.

The size of files with cartographic data is about 900Mb. Working time was measured in milliseconds:
Java: 28103ms
Scala: 30837ms
C#: 32160ms
Kotlin: 33580ms
Fantom: 37063ms
Qt/C++: 39058ms
Ceylon: test failed, 8Gb of RAM is not enough:
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded

Ceylon (JavaLibs): 41392ms

Unfortunately, Ceylon is last... When I try to use Ceylon HashMap and ArrayList I had got Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded

I have solved problem when use Java HashMap and ArrayList instead, but Ceylon is last anyway.

Stephane Epardaud

unread,
Dec 18, 2017, 6:13:09 AM12/18/17
to ceylon...@googlegroups.com
That's rather surprising. Can we look at your code to see why this would happen?

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/cf0af011-819f-4b8f-bfc9-219d7b168027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Alexander Kornilov

unread,
Dec 18, 2017, 7:56:39 AM12/18/17
to ceylon-users
https://drive.google.com/open?id=1N3sEsw4MZ33GI-PPQOw_vocahGdjg9bq

Example of cartographic file (line with segment):
SEG:-157.97411:21.70027:-157.97398:21.70033:<some segment attributes>:ClustID:74389219:


понедельник, 18 декабря 2017 г., 14:13:09 UTC+3 пользователь Stéphane Épardaud написал:
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.



--
Stéphane Épardaud

Stephane Epardaud

unread,
Dec 18, 2017, 8:51:48 AM12/18/17
to ceylon...@googlegroups.com
Do you have an example data file? 4 lines doesn't seem enough to cause the OOM.

To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Alexander Kornilov

unread,
Dec 18, 2017, 9:16:52 AM12/18/17
to ceylon-users
Yes, I have, but I can't share it, because it proprietary information of our customer.
Maybe I can try to found some open cartographic data like as OpenStreetMap and convert it to DCF...

понедельник, 18 декабря 2017 г., 16:51:48 UTC+3 пользователь Stéphane Épardaud написал:



--
Stéphane Épardaud

Alexander Kornilov

unread,
Dec 19, 2017, 8:03:02 AM12/19/17
to ceylon-users
Stéphane,

I had a little bit time and I have prepared very simple map converter for you. I wrote it on Kotlin (additional practice :) ). The mp2dcf tool convert *.mp file (Polish Map Fomramt) to DCF file. It isn't full-functional converter because it can extract only segments without any attributes, but it enough for our test case.
You can download it: https://drive.google.com/open?id=12SlixUmpnrKH5Eh8k69m_T1tmWCVy6Ko
Usage is: mp2dcf <input directory with .mp (Polish map format)> [output directory]"

Also free download of .mp files is avialable at: http://navitel.osm.rambler.ru

I can reproduce Ceylon OOM issue on Italy maps (http://navitel.osm.rambler.ru/?country=Italy):
Italy-Emilia-Romagna.mp
Italy-Friuli_Venezia_Giulia.mp
Italy-Liguria.mp
Italy-Lombardia.mp
Italy-Piemonte.mp
Italy-Sardegna.mp
Italy-Sicilia.mp

After convertion summary size of DCF files should be more than 1Gb and Ceylon fails with RAM 8Gb.

Hope it will help you improve Ceylon.

Stephane Epardaud

unread,
Dec 19, 2017, 10:05:27 AM12/19/17
to ceylon...@googlegroups.com
For me it takes about 4.7g of RAM (for 7g allocated), and runs in 60s:

$ ceylon run com.loggersoft.ceylon.performance/1.0.0 ../
Start...
Processing Italy-Sardegna.dcf...
Processing Italy-Friuli_Venezia_Giulia.dcf...
Processing Italy-Piemonte.dcf...
Processing Italy-Lombardia.dcf...
Processing Italy-Liguria.dcf...
Processing Italy-Sicilia.dcf...
Processing Italy-Emilia-Romagna.dcf...
Processing example.dcf...
Found 1891645 segments;
Finish: 57346ms

Most instances are Position, char[], DcfSegment, j.l.String, c.l.ArrayList, which seems reasonable given the code. Lemme compare to the other impls.

The version with Java collections appears to take the same speed (62s), same RAM (4g max for 6g allocated) at and has most instances be Position, char[], j.l.String, DcfSegment, Object[], c.l.String, which looks very similar. It's not immediatly obvious why there's a difference in allocation, but it doesn't seem large.

I'll keep looking, though.

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Stephane Epardaud

unread,
Dec 19, 2017, 10:13:53 AM12/19/17
to ceylon...@googlegroups.com
Java's program takes 40s for 3.5g of RAM (6.6g allocated). I'll have to take a look as to why there's a difference.
--
Stéphane Épardaud

Alexander Kornilov

unread,
Dec 19, 2017, 10:27:44 AM12/19/17
to ceylon-users
What total RAM on your PC?
What operation system?
What version of Java (Oracle or not)?

вторник, 19 декабря 2017 г., 18:05:27 UTC+3 пользователь Stéphane Épardaud написал:
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.



--
Stéphane Épardaud

Stephane Epardaud

unread,
Dec 19, 2017, 11:28:02 AM12/19/17
to ceylon...@googlegroups.com
Linux, 32g RAM, Java 8 openjdk

To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Alexander Kornilov

unread,
Dec 19, 2017, 11:47:21 AM12/19/17
to ceylon-users
OK. As I wrote before I also don't see any problems with RAM 24Gb, but if you want observe OOM exception I strict recommend you run it on PC with 8Gb. I can reproduce it with 100% under (Windows or Linux) VirtualBox with 8GB RAM.

вторник, 19 декабря 2017 г., 19:28:02 UTC+3 пользователь Stéphane Épardaud написал:



--
Stéphane Épardaud

Nikolay Tsankov

unread,
Dec 19, 2017, 11:59:03 AM12/19/17
to ceylon...@googlegroups.com
How many CPUs? IIRC there was some logic in the jvm for single CPU machines to use the serial collector by default...
In any case, enabling the GC logs might help diagnose the problem:  -XX:+PrintGCDetails

To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

John Vasileff

unread,
Dec 19, 2017, 12:23:37 PM12/19/17
to ceylon...@googlegroups.com

> On Dec 19, 2017, at 11:47 AM, Alexander Kornilov <akorni...@gmail.com> wrote:
>
> OK. As I wrote before I also don't see any problems with RAM 24Gb, but if you want observe OOM exception I strict recommend you run it on PC with 8Gb. I can reproduce it with 100% under (Windows or Linux) VirtualBox with 8GB RAM.

To test with a specific maximum heap size, for example 2GB, you can use:

JAVA_OPTS=-Xmx2g ceylon run com.example.module

John

Alexander Kornilov

unread,
Dec 26, 2017, 7:03:54 AM12/26/17
to ceylon-users
Hi, all!

I have uploaded sources into Github: https://github.com/akornilov/LangBenchmark

Also I have fixed bug in Java implementation, which allowed it work faster.

Please take a look for updates.

My idea is Ceylon work slower because it strings is 32 bit.

Gavin King

unread,
Jan 13, 2018, 9:19:33 AM1/13/18
to ceylon...@googlegroups.com
On Tue, Dec 26, 2017 at 1:03 PM, Alexander Kornilov
<akorni...@gmail.com> wrote:

> My idea is Ceylon work slower because it strings is 32 bit.

Naw, that can't be it, since Ceylon Strings are just Java Strings
under the covers.


--
Gavin King
Red Hat
ga...@ceylon-lang.org
@1ovthafew
Reply all
Reply to author
Forward
0 new messages