My experiments with jdk8
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main
.gitignore
README.md
pom.xml

README.md

Jdk8Experiments

My experiments with jdk8

This is JDK8 experiments, so JDK8 is needed :)

First case : movies

Dataset

The dataset is a list of movies with for each movies the list of actors of it : movies-mpaa

Code

The code is under package fr.ybonnel.movies Main class is Movies

Find the actor who played in more movies

Method : Movies.actorWithMaxMovies

Result :

Start Sequential
Actor{firstName='Frank', lastName='Welker'}=92
End of Sequential, time : 4 min 48 s 744 ms
Start Parallel
Actor{firstName='Frank', lastName='Welker'}=92
End of Parallel, time : 1 min 44 s 638 ms
Start From movies
Actor{firstName='Frank', lastName='Welker'}=92
End of From movies, time : 174 ms
Start From movies parallel
Actor{firstName='Frank', lastName='Welker'}=92
End of From movies parallel, time : 140 ms
Start jdk7
Actor{firstName='Frank', lastName='Welker'}=92
End of jdk7, time : 135 ms

Find the actor who played in more movies in one year

Method : Movies.actorWithMaxMoviesInAYear

Result :

Start jdk7
Year : 1999, Actor : Actor{firstName='Phil', lastName='Hawn'}, Movies : 24
End of jdk7, time : 143 ms
Start jdk8
Year : 1999, Actor : Actor{firstName='Phil', lastName='Hawn'}, Movies : 24
End of jdk8, time : 233 ms
Start jdk8 - parrallel
Year : 1999, Actor : Actor{firstName='Phil', lastName='Hawn'}, Movies : 24
End of jdk8 - parrallel, time : 170 ms

Second case : chessboard

Rules

Is a chessboard of n * m cells and a pawn placed at the bottom left, how many are there possible route to reach the square at the top right moving only along the horizontal and vertical axes? A pawn can only move up or right.

Code

The code is under package fr.ybonnel.chessboard

Calculate for a chessboard 1000x1000

Start Chessboard 1000 - sequential
512294053774259558362972111801106814506359401696197357133662490663268680890966422168317407249277190145438911035517264555381561230116189292650837306095363076178842645481320822198226994485371813976409676367032381831285411152247284028125396742405627998638503788368259307920236258027800099771751391617605088924033394630230806037178021722568614945945597158227817488131642780881551702876651234929533423690387735417418121162690198676382656195692212519230804188796272372873746380773141117366928488415626459630446598074332450038402866155063023175006229242447751399777865500335793470023989772130248615305440000
End of Chessboard 1000 - sequential, time : 621 ms
Start Chessboard 1000 - parallel
512294053774259558362972111801106814506359401696197357133662490663268680890966422168317407249277190145438911035517264555381561230116189292650837306095363076178842645481320822198226994485371813976409676367032381831285411152247284028125396742405627998638503788368259307920236258027800099771751391617605088924033394630230806037178021722568614945945597158227817488131642780881551702876651234929533423690387735417418121162690198676382656195692212519230804188796272372873746380773141117366928488415626459630446598074332450038402866155063023175006229242447751399777865500335793470023989772130248615305440000
End of Chessboard 1000 - parallel, time : 421 ms

Calculate for a chessboard 10000x10000

Start Chessboard 10000 - sequential
561428737123442557515768147446838128803874435166727897300042610148602485205158769299582985472739216066380634992597054002998755585863302660343639458855790152465291334719844406602840255517195628175384328514516928614144901077703443037312894949589509166289610174180317147127409643022180027481296530353512936235524693976403557347008557963023426968314364394885860745939056985624702233125769139842765677276066783452315603157047252479417698966966560941979591409618426096668005613845093157619640438923334312430580089701544142874827892258479478872231611346480011464779030693747319190080901095622388827583513978133459267054330733623692816539255131906123874958179270982239860590458701492078347096852509039337646837058288749301010954305424228787724290344140380798690471227526542633083812484691377500523347164564380075342665379358185133474139352092733476135309259112505205582485519132621291291417821633042021117846011873144403048780729902254682899246844137912863383378681898093357794652605607447377218364146299679075394348633974087452920479880655205868656773635491072204143414411133286828982774513852990929517618599494659044823698489020855628403032112842445421330574062334362481816709348863699133451395714132588243891931243629413947654553309214619155746845987753491150775660965175240225714648276640994940960228403767381011533148469652463354270599845930999585801159568532037757154228063023000670188839152965034615237908189412842967426827268908816846060898624501689431181039032127079077610157708868737617398204025646703220516556099552889416383856014006279729879179746178502433533776020668038800675703566649506217553210711742769998938509180816378233061286966716098832095305186716653330091712774514097959930174172712137315919845489213571815999059873145591357669436618874918263288317324102942096987141780232657280301644740446871031796783395443203167032196562199118700235092230510736652486557910162410228648785866278531756560445370729777381720950391853311969791603088501696120475095206485983748559618819309331983304867546023326475130256251299549706329758743432835362657684633972516666982499318838184829338308799970584668586883999615582403181936594780871992374748186701101054272374289546472139662875068726352721564480976430396385350966794641543524355381681690639176800514858137871521421484699890570256658553598877960401760823601278713272824958943574608438659799598452695379404304278749833857317931762009111165435219157910696604757801638567434844978649356260474245603103033993768281929976707602588162199906864053909840422005577626659362266873807967612690525199191641257723638058662773790038135816065135185200315619652387704730621722894436632864849940478529977259029783844574913794109093323329914750100200672116966870899213607088100157054515956962255321427280088413695736743804159063030860810728179862876011433202705143940128089429729404692821041959237783144153742147367647559791190760322872800734361621938650939396849598991119393486645886661148938594683489307442134222513141529208538598408188595878503061568673530135041955847637004411226756586664036208243000263895613973288329303377731337637856895804382380746366676229049241806316684491490392312074090881517529136277518030128425934420107181334120527372633246081630981304086193473651358667118949891073410566033630045641884735185119564242476630117608637871296615723213828711630372935853834822063502365565127587799796404983547421843259724551705389369279379520410863235673376757431426805431245926771033653088765419474695987633904387498637866330005246695959187404036029974840036973384725724079671765609491484686685209383451505758976540906620938600554332210533759512723200740988204599488704036341908636392029869603730266682212819410782509141469040705942892184011654211220794094805599709569850712008294974372222209033058053368676264802523906202198880563293952312598305327961469419584326300334360998313750344611517321150529826201895312173794203186666525965633546761557741337270607184245954463313734009447841625646107997204042601161680093995798833977178637237678759202007984461411525167941238890046175534636136216543894090195242476415157248646635015300318500092026690519914300638502215780096611026800805351211363487032746600838124615452960491356538390022552767136127278020125725876293502473386519705226432116416804857215926343523526508093481853143247890208707635214225118180478466595117112356073219629913169323777375776719099057474231434174190894700318538231350703259080769601761072244562506894066956718149593750166307761623959426890789400710812002961837007904271812549851185676761359627403146512762132450852685327173042028251218446664043511237337459506484528998669988076456078816518710099453387253862390810192188148374490427568588209028605505225902777012787124427353427734983374153588679314114775021804136730604133099181593644646174676479488151272866283957070435253315320967006887563998942969548760728929199946775359756870338830411455064294540647979984290604536388378549920634425431341272483892939591061905896747542293578476233738669924147525058240655639456487481185159386735906394545373309351609764514527579412884646904786749408113640602073140971309650658740366988279835893859230452888207471643692917462587384688543709941531988590337988272728660652953996231901585858400049898411094288358560296846267268729897091527390043885218703903692179120832145066793026668575651836557573797733271732055236477324193147682518273085727493551140496386806769030805837895068431996035812888670537716282247175941336073536880248388023542487787756834576810404924858435436769219753109096118712166082815750351162772974086456125953004558138739173873621467674620356743587351776660131725385849437396492733773981757319276228792315801218228889023938305008311980771571912452497026521545510343927170453058559526807943918732210385450119479075769510963933949876086259746512521817755090221236096232299080056831107233526742564701144904740815665641962472095901402541434531226709281912314683800727312424821117290700656954527483242161904562902187168559045792551349820922472620994312434442912783026024823038491799800344623896066416800000
End of Chessboard 10000 - sequential, time : 1 min 37 s 418 ms
Start Chessboard 10000 - parallel
561428737123442557515768147446838128803874435166727897300042610148602485205158769299582985472739216066380634992597054002998755585863302660343639458855790152465291334719844406602840255517195628175384328514516928614144901077703443037312894949589509166289610174180317147127409643022180027481296530353512936235524693976403557347008557963023426968314364394885860745939056985624702233125769139842765677276066783452315603157047252479417698966966560941979591409618426096668005613845093157619640438923334312430580089701544142874827892258479478872231611346480011464779030693747319190080901095622388827583513978133459267054330733623692816539255131906123874958179270982239860590458701492078347096852509039337646837058288749301010954305424228787724290344140380798690471227526542633083812484691377500523347164564380075342665379358185133474139352092733476135309259112505205582485519132621291291417821633042021117846011873144403048780729902254682899246844137912863383378681898093357794652605607447377218364146299679075394348633974087452920479880655205868656773635491072204143414411133286828982774513852990929517618599494659044823698489020855628403032112842445421330574062334362481816709348863699133451395714132588243891931243629413947654553309214619155746845987753491150775660965175240225714648276640994940960228403767381011533148469652463354270599845930999585801159568532037757154228063023000670188839152965034615237908189412842967426827268908816846060898624501689431181039032127079077610157708868737617398204025646703220516556099552889416383856014006279729879179746178502433533776020668038800675703566649506217553210711742769998938509180816378233061286966716098832095305186716653330091712774514097959930174172712137315919845489213571815999059873145591357669436618874918263288317324102942096987141780232657280301644740446871031796783395443203167032196562199118700235092230510736652486557910162410228648785866278531756560445370729777381720950391853311969791603088501696120475095206485983748559618819309331983304867546023326475130256251299549706329758743432835362657684633972516666982499318838184829338308799970584668586883999615582403181936594780871992374748186701101054272374289546472139662875068726352721564480976430396385350966794641543524355381681690639176800514858137871521421484699890570256658553598877960401760823601278713272824958943574608438659799598452695379404304278749833857317931762009111165435219157910696604757801638567434844978649356260474245603103033993768281929976707602588162199906864053909840422005577626659362266873807967612690525199191641257723638058662773790038135816065135185200315619652387704730621722894436632864849940478529977259029783844574913794109093323329914750100200672116966870899213607088100157054515956962255321427280088413695736743804159063030860810728179862876011433202705143940128089429729404692821041959237783144153742147367647559791190760322872800734361621938650939396849598991119393486645886661148938594683489307442134222513141529208538598408188595878503061568673530135041955847637004411226756586664036208243000263895613973288329303377731337637856895804382380746366676229049241806316684491490392312074090881517529136277518030128425934420107181334120527372633246081630981304086193473651358667118949891073410566033630045641884735185119564242476630117608637871296615723213828711630372935853834822063502365565127587799796404983547421843259724551705389369279379520410863235673376757431426805431245926771033653088765419474695987633904387498637866330005246695959187404036029974840036973384725724079671765609491484686685209383451505758976540906620938600554332210533759512723200740988204599488704036341908636392029869603730266682212819410782509141469040705942892184011654211220794094805599709569850712008294974372222209033058053368676264802523906202198880563293952312598305327961469419584326300334360998313750344611517321150529826201895312173794203186666525965633546761557741337270607184245954463313734009447841625646107997204042601161680093995798833977178637237678759202007984461411525167941238890046175534636136216543894090195242476415157248646635015300318500092026690519914300638502215780096611026800805351211363487032746600838124615452960491356538390022552767136127278020125725876293502473386519705226432116416804857215926343523526508093481853143247890208707635214225118180478466595117112356073219629913169323777375776719099057474231434174190894700318538231350703259080769601761072244562506894066956718149593750166307761623959426890789400710812002961837007904271812549851185676761359627403146512762132450852685327173042028251218446664043511237337459506484528998669988076456078816518710099453387253862390810192188148374490427568588209028605505225902777012787124427353427734983374153588679314114775021804136730604133099181593644646174676479488151272866283957070435253315320967006887563998942969548760728929199946775359756870338830411455064294540647979984290604536388378549920634425431341272483892939591061905896747542293578476233738669924147525058240655639456487481185159386735906394545373309351609764514527579412884646904786749408113640602073140971309650658740366988279835893859230452888207471643692917462587384688543709941531988590337988272728660652953996231901585858400049898411094288358560296846267268729897091527390043885218703903692179120832145066793026668575651836557573797733271732055236477324193147682518273085727493551140496386806769030805837895068431996035812888670537716282247175941336073536880248388023542487787756834576810404924858435436769219753109096118712166082815750351162772974086456125953004558138739173873621467674620356743587351776660131725385849437396492733773981757319276228792315801218228889023938305008311980771571912452497026521545510343927170453058559526807943918732210385450119479075769510963933949876086259746512521817755090221236096232299080056831107233526742564701144904740815665641962472095901402541434531226709281912314683800727312424821117290700656954527483242161904562902187168559045792551349820922472620994312434442912783026024823038491799800344623896066416800000
End of Chessboard 10000 - parallel, time : 54 s 17 ms

Fibonacci

Because test a language without fibonacci test is not a real test :)

Code

The code is under package fr.ybonnel.fibonacci

Calculate the 1,000,000th element of fibonacci

Result :

Start Fibonacci(1_000_000) jdk8
End of Fibonacci(1_000_000) jdk8, time : 18 s 721 ms
Start Fibonacci(1_000_000) jdk7
End of Fibonacci(1_000_000) jdk7, time : 18 s 111 ms

Differences between Set, List, Array and primitive array

The objective of this test is to see performance differences between steam based on Set, List, Array and primitive array.

Test

We test speed to find the max of 1M integers.

Code

The code is under package fr.ybonnel.setlistarray

Result

Start set(100)
End of set, time : 5 s 125 ms
Start set parallel(100)
End of set parallel, time : 1 s 652 ms
Start list(100)
End of list, time : 2 s 847 ms
Start list parallel(100)
End of list parallel, time : 887 ms
Start array(100)
End of array, time : 2 s 711 ms
Start array parallel(100)
End of array parallel, time : 873 ms
Start primitiveArray(100)
End of primitiveArray, time : 106 ms
Start primitiveArray parallel(100)
End of primitiveArray parallel, time : 52 ms