-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
performance improvement for ModelSupport.getElementInfoMap #2934
Conversation
While investigating startup performance, I found that ModelSupport takes a long time (~2 seconds) to initialize. The most obvious spot for improvement was ModelSupport.getElementInfoMap which is: 1. reading a file that contains class names for all model classes 2. finding those using Class.forName 3. iterating this list twice, and 4. reflecting over each class and its parents (even if they've already been visited in a previous iteration) I addressed much of that, but we're still reflecting over hundreds of classes and so its still not fast. In my local testing, the method is about twice as fast now, but it still takes over a second to initialize. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
I think the rationale behind going with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -449,18 +1103,50 @@ public boolean hasBinding() { | |||
return Collections.unmodifiableMap(resourceTypeMap); | |||
} | |||
|
|||
private static List<Field> getAllFields(Class<?> modelClass) { | |||
List<Field> fields = new ArrayList<>(); | |||
private static Map<String, ElementInfo> getElementInfoMap(Class<?> modelClass, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use some comments to explain what's going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. most of this code already existed and is doing the same thing...my big additions were to:
- use a list of classes (instead of reading them from a file and calling Class.forName); and
- pass the elementInfoMapCache to this method so that we're not calling 'getDeclaredFields' over and over on common superclasses like Element, BackboneElement, Resource, and DomainResource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments...please see if it helps
Binding binding = field.getAnnotation(Binding.class); | ||
Set<Class<?>> choiceTypes = choice ? Collections.unmodifiableSet(getChoiceTypes(field)) : Collections.emptySet(); | ||
Set<String> referenceTypes = reference ? Collections.unmodifiableSet(getReferenceTypes(field)) : Collections.emptySet(); | ||
elementInfoMap.put(elementName, new ElementInfo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how long this takes to build, but would it be possible to generate the content when building the model then serializing out to a file which can be read really quickly. But if it's only done once and doesn't impede the startup too much, it might not be worth the effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some timing info would be useful, even if it's just a nanoTime elapsed message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i took that timing info during the investigation of this one. after my changes, its averages to around 1ms for each model class and around 1 second total:
split: 4591520, total: 4591520
split: 8789116, total: 13380636
split: 4228280, total: 17608916
split: 221318, total: 17830234
split: 1607541, total: 19437775
split: 1696048, total: 21133823
split: 6301439, total: 27435262
split: 4047757, total: 31483019
split: 1132920, total: 32615939
split: 3939165, total: 36555104
split: 2664627, total: 39219731
split: 1237731, total: 40457462
split: 1206176, total: 41663638
split: 667988, total: 42331626
split: 88289, total: 42419915
split: 1673262, total: 44093177
split: 1785903, total: 45879080
split: 2669276, total: 48548356
split: 3534974, total: 52083330
split: 3268888, total: 55352218
split: 1858447, total: 57210665
split: 3753661, total: 60964326
split: 2616959, total: 63581285
split: 2362169, total: 65943454
split: 2353779, total: 68297233
split: 2647699, total: 70944932
split: 1687824, total: 72632756
split: 1174970, total: 73807726
split: 883357, total: 74691083
split: 4112088, total: 78803171
split: 2258244, total: 81061415
split: 896732, total: 81958147
split: 6914673, total: 88872820
split: 1228097, total: 90100917
split: 1227999, total: 91328916
split: 1329574, total: 92658490
split: 3211832, total: 95870322
split: 1522832, total: 97393154
split: 878902, total: 98272056
split: 687171, total: 98959227
split: 899895, total: 99859122
split: 1316683, total: 101175805
split: 1084821, total: 102260626
split: 1042836, total: 103303462
split: 1516677, total: 104820139
split: 1610665, total: 106430804
split: 755510, total: 107186314
split: 1501197, total: 108687511
split: 853720, total: 109541231
split: 1047543, total: 110588774
split: 502119, total: 111090893
split: 867886, total: 111958779
split: 715123, total: 112673902
split: 1530661, total: 114204563
split: 764398, total: 114968961
split: 1255803, total: 116224764
split: 926081, total: 117150845
split: 2853536, total: 120004381
split: 1332146, total: 121336527
split: 825675, total: 122162202
split: 761006, total: 122923208
split: 612054, total: 123535262
split: 1416457, total: 124951719
split: 1511413, total: 126463132
split: 1478420, total: 127941552
split: 429186, total: 128370738
split: 1054019, total: 129424757
split: 899205, total: 130323962
split: 1076971, total: 131400933
split: 993564, total: 132394497
split: 2085886, total: 134480383
split: 1157461, total: 135637844
split: 662039, total: 136299883
split: 607033, total: 136906916
split: 1066440, total: 137973356
split: 675187, total: 138648543
split: 858601, total: 139507144
split: 232692, total: 139739836
split: 606032, total: 140345868
split: 1875002, total: 142220870
split: 947459, total: 143168329
split: 884062, total: 144052391
split: 3360985, total: 147413376
split: 1237125, total: 148650501
split: 1183388, total: 149833889
split: 2044882, total: 151878771
split: 1059919, total: 152938690
split: 991567, total: 153930257
split: 1698724, total: 155628981
split: 1536361, total: 157165342
split: 2102423, total: 159267765
split: 1346211, total: 160613976
split: 1393794, total: 162007770
split: 1406195, total: 163413965
split: 1388952, total: 164802917
split: 1004572, total: 165807489
split: 1294092, total: 167101581
split: 891241, total: 167992822
split: 964610, total: 168957432
split: 1400687, total: 170358119
split: 855869, total: 171213988
split: 1660552, total: 172874540
split: 970822, total: 173845362
split: 866206, total: 174711568
split: 946388, total: 175657956
split: 911536, total: 176569492
split: 1306875, total: 177876367
split: 604717, total: 178481084
split: 528253, total: 179009337
split: 550364, total: 179559701
split: 699824, total: 180259525
split: 444439, total: 180703964
split: 382299, total: 181086263
split: 1353595, total: 182439858
split: 980093, total: 183419951
split: 558134, total: 183978085
split: 1073070, total: 185051155
split: 900959, total: 185952114
split: 1119342, total: 187071456
split: 1048613, total: 188120069
split: 672665, total: 188792734
split: 927177, total: 189719911
split: 401481, total: 190121392
split: 413679, total: 190535071
split: 458144, total: 190993215
split: 453885, total: 191447100
split: 454872, total: 191901972
split: 2293867, total: 194195839
split: 1521252, total: 195717091
split: 1735737, total: 197452828
split: 1580696, total: 199033524
split: 981700, total: 200015224
split: 1502667, total: 201517891
split: 1198011, total: 202715902
split: 2369555, total: 205085457
split: 1038185, total: 206123642
split: 1864929, total: 207988571
split: 869191, total: 208857762
split: 870341, total: 209728103
split: 903589, total: 210631692
split: 2165979, total: 212797671
split: 1041519, total: 213839190
split: 1385005, total: 215224195
split: 1542227, total: 216766422
split: 1461843, total: 218228265
split: 1979390, total: 220207655
split: 1572376, total: 221780031
split: 1417325, total: 223197356
split: 995154, total: 224192510
split: 1359027, total: 225551537
split: 1067577, total: 226619114
split: 1242103, total: 227861217
split: 2010739, total: 229871956
split: 1676056, total: 231548012
split: 1223964, total: 232771976
split: 1683324, total: 234455300
split: 1270502, total: 235725802
split: 1024309, total: 236750111
split: 1085177, total: 237835288
split: 921727, total: 238757015
split: 1121300, total: 239878315
split: 991795, total: 240870110
split: 1215938, total: 242086048
split: 963832, total: 243049880
split: 867957, total: 243917837
split: 1803432, total: 245721269
split: 910876, total: 246632145
split: 915909, total: 247548054
split: 1926075, total: 249474129
split: 559755, total: 250033884
split: 434058, total: 250467942
split: 444246, total: 250912188
split: 1096449, total: 252008637
split: 1298644, total: 253307281
split: 2131619, total: 255438900
split: 1297186, total: 256736086
split: 2728861, total: 259464947
split: 1130611, total: 260595558
split: 1499223, total: 262094781
split: 884962, total: 262979743
split: 1879762, total: 264859505
split: 955090, total: 265814595
split: 812820, total: 266627415
split: 844029, total: 267471444
split: 1391969, total: 268863413
split: 1610623, total: 270474036
split: 555694, total: 271029730
split: 458342, total: 271488072
split: 537509, total: 272025581
split: 1056353, total: 273081934
split: 994945, total: 274076879
split: 1735415, total: 275812294
split: 1165005, total: 276977299
split: 1002006, total: 277979305
split: 1488030, total: 279467335
split: 830780, total: 280298115
split: 1411506, total: 281709621
split: 861111, total: 282570732
split: 811234, total: 283381966
split: 783530, total: 284165496
split: 1855320, total: 286020816
split: 899338, total: 286920154
split: 801657, total: 287721811
split: 998268, total: 288720079
split: 919976, total: 289640055
split: 946448, total: 290586503
split: 1596011, total: 292182514
split: 2020637, total: 294203151
split: 949323, total: 295152474
split: 1782649, total: 296935123
split: 929912, total: 297865035
split: 1346058, total: 299211093
split: 1321627, total: 300532720
split: 1158362, total: 301691082
split: 1011681, total: 302702763
split: 1026370, total: 303729133
split: 1686555, total: 305415688
split: 948243, total: 306363931
split: 989931, total: 307353862
split: 835202, total: 308189064
split: 1703695, total: 309892759
split: 1084519, total: 310977278
split: 1388855, total: 312366133
split: 868577, total: 313234710
split: 934180, total: 314168890
split: 1665805, total: 315834695
split: 841126, total: 316675821
split: 1102135, total: 317777956
split: 1469009, total: 319246965
split: 1248684, total: 320495649
split: 1550992, total: 322046641
split: 939510, total: 322986151
split: 974445, total: 323960596
split: 1805152, total: 325765748
split: 889738, total: 326655486
split: 889282, total: 327544768
split: 854987, total: 328399755
split: 922333, total: 329322088
split: 911059, total: 330233147
split: 1817935, total: 332051082
split: 1102674, total: 333153756
split: 895029, total: 334048785
split: 1030121, total: 335078906
split: 962166, total: 336041072
split: 841079, total: 336882151
split: 843283, total: 337725434
split: 1426412, total: 339151846
split: 873563, total: 340025409
split: 1808837, total: 341834246
split: 921323, total: 342755569
split: 1800185, total: 344555754
split: 1844623, total: 346400377
split: 1169379, total: 347569756
split: 2101925, total: 349671681
split: 945485, total: 350617166
split: 1835595, total: 352452761
split: 884799, total: 353337560
split: 1336338, total: 354673898
split: 892898, total: 355566796
split: 2075129, total: 357641925
split: 890466, total: 358532391
split: 940004, total: 359472395
split: 1098670, total: 360571065
split: 829100, total: 361400165
split: 912684, total: 362312849
split: 826620, total: 363139469
split: 1737751, total: 364877220
split: 813971, total: 365691191
split: 879632, total: 366570823
split: 1255793, total: 367826616
split: 922061, total: 368748677
split: 917083, total: 369665760
split: 1017782, total: 370683542
split: 1931928, total: 372615470
split: 1251195, total: 373866665
split: 1205849, total: 375072514
split: 1623518, total: 376696032
split: 867420, total: 377563452
split: 813555, total: 378377007
split: 1795803, total: 380172810
split: 1555339, total: 381728149
split: 1711641, total: 383439790
split: 1245693, total: 384685483
split: 1884127, total: 386569610
split: 869795, total: 387439405
split: 1005587, total: 388444992
split: 776453, total: 389221445
split: 754638, total: 389976083
split: 972015, total: 390948098
split: 1001993, total: 391950091
split: 814405, total: 392764496
split: 1001190, total: 393765686
split: 2565894, total: 396331580
split: 1064252, total: 397395832
split: 1764286, total: 399160118
split: 1460694, total: 400620812
split: 1654655, total: 402275467
split: 1234779, total: 403510246
split: 988843, total: 404499089
split: 903939, total: 405403028
split: 1167853, total: 406570881
split: 914357, total: 407485238
split: 1640560, total: 409125798
split: 882759, total: 410008557
split: 1493636, total: 411502193
split: 1362036, total: 412864229
split: 840393, total: 413704622
split: 918231, total: 414622853
split: 1313920, total: 415936773
split: 894736, total: 416831509
split: 897793, total: 417729302
split: 1191192, total: 418920494
split: 1105747, total: 420026241
split: 2046068, total: 422072309
split: 1105909, total: 423178218
split: 1201912, total: 424380130
split: 1519373, total: 425899503
split: 916890, total: 426816393
split: 1529761, total: 428346154
split: 893495, total: 429239649
split: 1085207, total: 430324856
split: 929625, total: 431254481
split: 1332946, total: 432587427
split: 949028, total: 433536455
split: 827183, total: 434363638
split: 1460530, total: 435824168
split: 1677019, total: 437501187
split: 846409, total: 438347596
split: 834021, total: 439181617
split: 823096, total: 440004713
split: 1972470, total: 441977183
split: 1325877, total: 443303060
split: 952014, total: 444255074
split: 925811, total: 445180885
split: 1937811, total: 447118696
split: 809765, total: 447928461
split: 878157, total: 448806618
split: 1103081, total: 449909699
split: 898998, total: 450808697
split: 1378791, total: 452187488
split: 1084365, total: 453271853
split: 1278268, total: 454550121
split: 787551, total: 455337672
split: 1549935, total: 456887607
split: 964034, total: 457851641
split: 792449, total: 458644090
split: 1008299, total: 459652389
split: 761759, total: 460414148
split: 1013001, total: 461427149
split: 813776, total: 462240925
split: 833147, total: 463074072
split: 847307, total: 463921379
split: 1408658, total: 465330037
split: 1078467, total: 466408504
split: 1133680, total: 467542184
split: 1677875, total: 469220059
split: 1216870, total: 470436929
split: 1011936, total: 471448865
split: 869649, total: 472318514
split: 780203, total: 473098717
split: 1092729, total: 474191446
split: 764409, total: 474955855
split: 760340, total: 475716195
split: 750000, total: 476466195
split: 989266, total: 477455461
split: 1377052, total: 478832513
split: 786310, total: 479618823
split: 781450, total: 480400273
split: 717072, total: 481117345
split: 1845008, total: 482962353
split: 1167991, total: 484130344
split: 930774, total: 485061118
split: 1943407, total: 487004525
split: 966764, total: 487971289
split: 1613465, total: 489584754
split: 1108462, total: 490693216
split: 1029189, total: 491722405
split: 2302912, total: 494025317
split: 858741, total: 494884058
split: 840072, total: 495724130
split: 1015458, total: 496739588
split: 988958, total: 497728546
split: 928850, total: 498657396
split: 1418666, total: 500076062
split: 953565, total: 501029627
split: 872458, total: 501902085
split: 852132, total: 502754217
split: 1036495, total: 503790712
split: 786980, total: 504577692
split: 841803, total: 505419495
split: 1806356, total: 507225851
split: 1101280, total: 508327131
split: 761172, total: 509088303
split: 859111, total: 509947414
split: 1717828, total: 511665242
split: 778533, total: 512443775
split: 690832, total: 513134607
split: 1642965, total: 514777572
split: 771358, total: 515548930
split: 1031743, total: 516580673
split: 1682387, total: 518263060
split: 994315, total: 519257375
split: 963540, total: 520220915
split: 854155, total: 521075070
split: 927271, total: 522002341
split: 1121119, total: 523123460
split: 867065, total: 523990525
split: 823234, total: 524813759
split: 754860, total: 525568619
split: 748696, total: 526317315
split: 748321, total: 527065636
split: 738232, total: 527803868
split: 929610, total: 528733478
split: 733010, total: 529466488
split: 726714, total: 530193202
split: 725116, total: 530918318
split: 839122, total: 531757440
split: 2081638, total: 533839078
split: 1097135, total: 534936213
split: 833902, total: 535770115
split: 929426, total: 536699541
split: 1760023, total: 538459564
split: 1702110, total: 540161674
split: 1165488, total: 541327162
split: 1011742, total: 542338904
split: 826366, total: 543165270
split: 1072457, total: 544237727
split: 1099598, total: 545337325
split: 1447471, total: 546784796
split: 1474764, total: 548259560
split: 1236637, total: 549496197
split: 1211028, total: 550707225
split: 968435, total: 551675660
split: 1340336, total: 553015996
split: 887120, total: 553903116
split: 1230898, total: 555134014
split: 1000166, total: 556134180
split: 1392212, total: 557526392
split: 1248226, total: 558774618
split: 915434, total: 559690052
split: 1080225, total: 560770277
split: 879625, total: 561649902
split: 1153531, total: 562803433
split: 1418306, total: 564221739
split: 899952, total: 565121691
split: 1335932, total: 566457623
split: 1372731, total: 567830354
split: 884127, total: 568714481
split: 1183816, total: 569898297
split: 880769, total: 570779066
split: 1025179, total: 571804245
split: 1394882, total: 573199127
split: 2938300, total: 576137427
split: 976170, total: 577113597
split: 1079601, total: 578193198
split: 1778566, total: 579971764
split: 1248727, total: 581220491
split: 971838, total: 582192329
split: 1046538, total: 583238867
split: 1653775, total: 584892642
split: 1521875, total: 586414517
split: 1663406, total: 588077923
split: 1337218, total: 589415141
split: 1067862, total: 590483003
split: 1319637, total: 591802640
split: 1022410, total: 592825050
split: 1038482, total: 593863532
split: 999521, total: 594863053
split: 1895377, total: 596758430
split: 992519, total: 597750949
split: 1560358, total: 599311307
split: 1171796, total: 600483103
split: 919882, total: 601402985
split: 1241310, total: 602644295
split: 1078137, total: 603722432
split: 820423, total: 604542855
split: 894306, total: 605437161
split: 1241428, total: 606678589
split: 1349688, total: 608028277
split: 1050389, total: 609078666
split: 1381088, total: 610459754
split: 1460675, total: 611920429
split: 1041863, total: 612962292
split: 1788426, total: 614750718
split: 881110, total: 615631828
split: 1420681, total: 617052509
split: 856136, total: 617908645
split: 807208, total: 618715853
split: 506078, total: 619221931
split: 533313, total: 619755244
split: 1469707, total: 621224951
split: 922771, total: 622147722
split: 1420116, total: 623567838
split: 413911, total: 623981749
split: 801854, total: 624783603
split: 1119267, total: 625902870
split: 949703, total: 626852573
split: 1183487, total: 628036060
split: 974603, total: 629010663
split: 1224985, total: 630235648
split: 1402892, total: 631638540
split: 1314588, total: 632953128
split: 1030677, total: 633983805
split: 1403039, total: 635386844
split: 1157554, total: 636544398
split: 2960141, total: 639504539
split: 1776168, total: 641280707
split: 904136, total: 642184843
split: 1048974, total: 643233817
split: 889262, total: 644123079
split: 919213, total: 645042292
split: 1175400, total: 646217692
split: 909931, total: 647127623
split: 1347442, total: 648475065
split: 896081, total: 649371146
split: 1450572, total: 650821718
split: 955004, total: 651776722
split: 877798, total: 652654520
split: 2614656, total: 655269176
split: 903498, total: 656172674
split: 900886, total: 657073560
split: 2134667, total: 659208227
split: 1000180, total: 660208407
split: 1038796, total: 661247203
split: 1677263, total: 662924466
split: 1367050, total: 664291516
split: 951594, total: 665243110
split: 1083504, total: 666326614
split: 944160, total: 667270774
split: 2305905, total: 669576679
split: 1124349, total: 670701028
split: 997041, total: 671698069
split: 1426091, total: 673124160
split: 1006881, total: 674131041
split: 1985478, total: 676116519
split: 1696337, total: 677812856
split: 931264, total: 678744120
split: 1154326, total: 679898446
split: 1992596, total: 681891042
split: 1918310, total: 683809352
split: 1476003, total: 685285355
split: 2183155, total: 687468510
split: 965086, total: 688433596
split: 784108, total: 689217704
split: 1438374, total: 690656078
split: 1626631, total: 692282709
split: 1090913, total: 693373622
split: 1932698, total: 695306320
split: 896112, total: 696202432
split: 890043, total: 697092475
split: 1099361, total: 698191836
split: 856781, total: 699048617
split: 745013, total: 699793630
split: 1395745, total: 701189375
split: 1115705, total: 702305080
split: 809981, total: 703115061
split: 2137562, total: 705252623
split: 1537093, total: 706789716
split: 1849288, total: 708639004
split: 1154434, total: 709793438
split: 1304938, total: 711098376
split: 1023407, total: 712121783
split: 1401067, total: 713522850
split: 1332530, total: 714855380
split: 1249311, total: 716104691
split: 910869, total: 717015560
split: 1097190, total: 718112750
split: 1405634, total: 719518384
split: 959528, total: 720477912
split: 856426, total: 721334338
split: 1121826, total: 722456164
split: 511856, total: 722968020
split: 1633870, total: 724601890
split: 1174025, total: 725775915
split: 1120773, total: 726896688
split: 1636399, total: 728533087
split: 2596497, total: 731129584
split: 2057902, total: 733187486
split: 1679918, total: 734867404
split: 1238945, total: 736106349
split: 891776, total: 736998125
split: 1334719, total: 738332844
split: 940460, total: 739273304
split: 1293726, total: 740567030
split: 924198, total: 741491228
split: 835101, total: 742326329
split: 1029697, total: 743356026
split: 1091447, total: 744447473
split: 960041, total: 745407514
split: 772924, total: 746180438
split: 1203185, total: 747383623
split: 837821, total: 748221444
split: 852735, total: 749074179
split: 870384, total: 749944563
split: 1091446, total: 751036009
split: 758619, total: 751794628
split: 885533, total: 752680161
split: 1313828, total: 753993989
split: 1514507, total: 755508496
split: 1237069, total: 756745565
split: 1481412, total: 758226977
split: 1162815, total: 759389792
split: 905319, total: 760295111
split: 1430901, total: 761726012
split: 2173282, total: 763899294
split: 1043022, total: 764942316
split: 1152514, total: 766094830
split: 872666, total: 766967496
split: 804979, total: 767772475
split: 871159, total: 768643634
split: 870709, total: 769514343
split: 1757712, total: 771272055
split: 958311, total: 772230366
split: 922847, total: 773153213
split: 1276482, total: 774429695
split: 1034107, total: 775463802
split: 965568, total: 776429370
split: 1219442, total: 777648812
split: 1118812, total: 778767624
split: 880175, total: 779647799
split: 712243, total: 780360042
split: 703944, total: 781063986
split: 1226208, total: 782290194
split: 830429, total: 783120623
split: 1938440, total: 785059063
split: 1242995, total: 786302058
split: 2053408, total: 788355466
split: 1209330, total: 789564796
split: 1228536, total: 790793332
split: 831637, total: 791624969
split: 1176706, total: 792801675
split: 381304, total: 793182979
split: 374886, total: 793557865
split: 468587, total: 794026452
split: 781825, total: 794808277
split: 438590, total: 795246867
split: 754919, total: 796001786
split: 352797, total: 796354583
split: 341578, total: 796696161
split: 314012, total: 797010173
split: 325346, total: 797335519
split: 1392741, total: 798728260
split: 818370, total: 799546630
split: 872072, total: 800418702
split: 724768, total: 801143470
split: 736849, total: 801880319
split: 762818, total: 802643137
split: 696417, total: 803339554
split: 665085, total: 804004639
split: 757219, total: 804761858
split: 791699, total: 805553557
split: 1614162, total: 807167719
split: 775627, total: 807943346
split: 781059, total: 808724405
split: 712989, total: 809437394
split: 1042839, total: 810480233
split: 734833, total: 811215066
split: 714429, total: 811929495
split: 714671, total: 812644166
split: 702444, total: 813346610
split: 1319739, total: 814666349
split: 1209295, total: 815875644
split: 768836, total: 816644480
split: 713283, total: 817357763
split: 738377, total: 818096140
split: 765092, total: 818861232
split: 729510, total: 819590742
split: 837348, total: 820428090
split: 957175, total: 821385265
split: 447814, total: 821833079
split: 438350, total: 822271429
split: 760667, total: 823032096
split: 1033754, total: 824065850
split: 466526, total: 824532376
split: 905610, total: 825437986
split: 958090, total: 826396076
split: 780725, total: 827176801
split: 1332045, total: 828508846
split: 1009021, total: 829517867
split: 1101653, total: 830619520
split: 772759, total: 831392279
split: 1140685, total: 832532964
split: 1242086, total: 833775050
split: 865440, total: 834640490
of course thats not very rigorous as it goes much faster if you run multiple times in quick succession. would need to create a proper microbenchmark if we want more accuracy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's the stats on those splits (according to excel):
Mean 1220234.635
Standard Error 26210.66124
Median 1041691
Mode #N/A
Standard Deviation 685497.7416
Sample Variance 4.69907E+11
Kurtosis 34.66406176
Skewness 4.445432414
Range 8700827
Minimum 88289
Maximum 8789116
Sum 834640490
Count 684
Confidence Level(95.0%) 51463.14862
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Robin's comments are superb. I don't think I can add more right now. LGTM
fhir-model/src/main/java/com/ibm/fhir/model/util/ModelSupport.java
Outdated
Show resolved
Hide resolved
fhir-model/src/main/java/com/ibm/fhir/model/util/ModelSupport.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
While investigating startup performance, I found that ModelSupport takes
a long time (~2 seconds) to initialize.
The most obvious spot for improvement was ModelSupport.getElementInfoMap
which is:
been visited in a previous iteration)
I addressed much of that, but we're still reflecting over hundreds of
classes and so its still not fast. In my local testing, the method is
about twice as fast now, but it still takes over a second to initialize.
Signed-off-by: Lee Surprenant lmsurpre@us.ibm.com