Skip to content
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

⚡️ Speed-up all safe versions built-in methods #3112

Merged
merged 13 commits into from
Sep 6, 2022
Merged

⚡️ Speed-up all safe versions built-in methods #3112

merged 13 commits into from
Sep 6, 2022

Conversation

dubzzz
Copy link
Owner

@dubzzz dubzzz commented Sep 2, 2022

By applying tricks uncovered during benchmarking phase on https://github.com/dubzzz/fast-check-benchmarks/blob/main/benchmark-poisoning.js

Follow-up of #3109

Category:

  • ✨ Introduce new features
  • 📝 Add or update documentation
  • ✅ Add or update tests
  • 🐛 Fix a bug
  • 🏷️ Add or update types
  • ⚡️ Improve performance
  • Other(s): ...

Potential impacts:

  • Generated values
  • Shrink values
  • Performance
  • Typings
  • Other(s): ...

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 2, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 30faa90:

Sandbox Source
Vanilla Configuration
@fast-check/examples Configuration

@dubzzz
Copy link
Owner Author

dubzzz commented Sep 2, 2022

Base automatically changed from smaller-globals to main September 2, 2022 18:41
@dubzzz
Copy link
Owner Author

dubzzz commented Sep 2, 2022

@dubzzz
Copy link
Owner Author

dubzzz commented Sep 6, 2022

Benchmark running for commit 2366bbe is https://github.com/dubzzz/fast-check-benchmarks/runs/8216445638?check_suite_focus=true. This recent update leverages observations made in https://github.com/dubzzz/fast-check-benchmarks/blob/2f15fc5c95b89dd8dbe8bef60b234d84dccf9208/benchmark-poisoning-v2.js.

Algorithm;3.0.0;3.1.0;main;extra
Property(fc.boolean());8127.058120790612;8164.357542838923;7139.479011837762;7761.207206544183
Property(fc.integer());7960.5204243907065;7896.251819859348;6878.541348392174;7478.350725351646
Property(fc.maxSafeInteger());7570.250266716927;7509.840329019465;6609.5538458105575;7245.669072716655
Property(fc.float());7103.6251222516175;6990.754843600477;6319.49178752772;6872.905127579693
Property(fc.double());5587.0155294325305;5545.196461692587;4997.841242687673;5412.956111776692
Property(fc.bigInt());2283.850745015436;2293.213711179993;2114.3541351694353;2297.1252990946114
Property(fc.char());7742.168212312937;7619.986025832522;6798.6392499251215;7461.953081554623
Property(fc.string());4075.3661506374574;3877.9942383267653;2895.622152960309;3654.7567748232477
Property(fc.string({ minLength: 0, maxLength: 500, size: 'max' }));223.28170474331174;227.0916691821276;155.5690093122725;224.03733383702308
Property(fc.string({ minLength: 0, maxLength: 25_000, size: 'max' }));3.2614491214766446;3.429433038565942;2.2916485407671403;3.413438419202401
Property(fc.array(fc.integer()));5346.946664422756;5183.486828537484;3938.730630946454;4901.132335520747
Property(fc.array(fc.integer(), { minLength: 0, maxLength: 500, size: 'max' }));404.69009378135627;374.58903445922294;212.76851027703975;324.2050872007599
Property(fc.array(fc.integer(), { minLength: 0, maxLength: 25_000, size: 'max' }));6.461838144181366;6.043376493820621;3.526605560184459;5.354120671779135
Property(fc.uniqueArray(fc.integer()));4706.622490523423;4524.034538467067;3395.2308907933148;4219.7638463034855
Property(fc.uniqueArray(fc.integer(), { minLength: 0, maxLength: 500, size:'max' }));263.880994477705;240.53170300699242;155.09837290049654;219.13119297477766
Property(fc.anything());470.81841087626935;446.18615133481245;367.03672377088964;449.037467879936
Property(fc.constant('a'));8953.410397974369;8943.788827331342;7735.34644386849;8677.737801890256
Property(fc.constantFrom('a', 'b', 'c'));8619.281296966476;8575.786214546848;7488.532521379356;8555.946937561093
Property(fc.option(fc.integer()));7605.399119255056;7594.05661157354;6681.5715401820335;7246.950399014285
Property(fc.oneof(fc.ascii(), fc.hexa()));7126.655890647109;7002.431590513946;6285.507900915714;6981.176241098234
Property(fc.oneof(fc.ascii()@w=1, fc.hexa()@w=2));7174.003868656456;7116.878499724661;6370.300805663787;6966.452275488812
Property(fc.tuple(fc.ascii(), fc.hexa()));6050.695067674314;5952.5247228951375;4902.2931384807;5848.370436747239
Property(fc.record({ascii: fc.ascii(), hexa: fc.hexa()}));5334.086080024862;5408.923359810969;3376.771833836468;3878.5527559408715
Property(<tree-with-letrec>);4178.715637789708;4135.310973669614;3330.797017061485;4095.0731697618517
Property(<comment-generator-letrec>);2262.9228889215215;2277.8403359640292;1817.6287068261552;2129.5536534235584
Property(fc.emailAddress());584.5676080349164;67.759275553422;64.5451395726892;68.19983935909923
Property(fc.webUrl());1177.9486059926257;128.65519050140043;121.76197285777444;127.61662777899272
Property(fc.integer().filter(() => true));7966.795058801619;7855.244342516287;6856.418685370052;7560.7389505525725
Property(fc.integer().map(n => n));7790.664468950936;7762.669834711786;6798.941736581583;7440.753914503382
Property(fc.integer().chain(() => fc.integer()));6830.5248344735255;6800.681347407847;6079.298209678371;6546.705032545331
Property(fc.integer().noBias());8378.741255676308;8410.034956213323;7364.140414195845;8186.835045765797
Property(fc.integer().noShrink());8119.247039358333;8160.368176338173;7121.498803903827;7805.7758646066995

@dubzzz
Copy link
Owner Author

dubzzz commented Sep 6, 2022

Regression comes from the fact that:

[1,2,3,4].splice(1)
// > [ 2, 3, 4 ]
[1,2,3,4].splice(1, undefined)
// > []

@dubzzz
Copy link
Owner Author

dubzzz commented Sep 6, 2022

Benchmark running against 30faa90 at https://github.com/dubzzz/fast-check-benchmarks/actions/runs/3003637036

Algorithm;2.25.0;3.0.0;3.1.0;main;extra
Property(fc.boolean());7732.366985394177;7934.89523402714;8121.435984608585;7088.129382038272;7958.786510446039
Property(fc.integer());7591.8254186044005;7931.335521862838;7813.125703864433;7029.235368534506;7802.097205798839
Property(fc.maxSafeInteger());7208.58328384123;7535.476125254804;7448.195113285718;6791.653279694744;7444.253710392971
Property(fc.float());7005.6571882522985;7147.013104622224;7131.173416895203;6480.662530033762;7033.599339282673
Property(fc.double());5360.655456888312;5452.820092946433;5443.2627383628615;5125.043780637999;5412.510367215613
Property(fc.bigInt());2253.981927028956;2316.2723644458065;2303.5010330430564;2201.666725174032;2288.6593489450647
Property(fc.char());7489.341769617854;7672.622156543589;7693.873423528458;6933.809800674903;7614.769603224224
Property(fc.string());3839.054910995806;4087.40753077307;3888.884383273714;2951.7593611121424;3733.1366929842766
Property(fc.string({ minLength: 0, maxLength: 500, size: 'max' }));229.45521711275472;230.47434836378943;229.42551619534527;156.46786651704903;214.36691221152768
Property(fc.string({ minLength: 0, maxLength: 25_000, size: 'max' }));3.15152389173427;3.1617315234578687;3.2593207250853844;2.218969885574908;3.1621769158828363
Property(fc.array(fc.integer()));4997.527020456769;5286.541939421464;5096.061001593508;3951.695087848088;5108.808273274896
Property(fc.array(fc.integer(), { minLength: 0, maxLength: 500, size: 'max' }));398.3884809181227;399.7217253555054;371.0711979914885;213.51978880868134;372.2945252039107
Property(fc.array(fc.integer(), { minLength: 0, maxLength: 25_000, size: 'max' }));6.207563771241447;6.087853879364647;5.792738064099944;3.510216858819365;5.8843383861754806
Property(fc.uniqueArray(fc.integer()));4423.226407033438;4589.063434139518;4488.749881074555;3446.362920950485;4457.733217109699
Property(fc.uniqueArray(fc.integer(), { minLength: 0, maxLength: 500, size:'max' }));245.31296429331866;255.44035124685428;234.58239670956138;151.9965359388543;234.33358522505583
Property(fc.anything());1179.5381166502898;450.98712766227226;418.56341421974787;342.25200001070704;422.4544731646192
Property(fc.constant('a'));8277.280428882428;8603.7813811675;8510.580794114878;7459.485230359118;8417.026189229255
Property(fc.constantFrom('a', 'b', 'c'));8275.780074850341;8518.84453152774;8529.92340140013;7513.520498665082;8430.12012153096
Property(fc.option(fc.integer()));7128.773688291387;7305.827959948277;7344.236128580469;6445.253598250519;7088.59066337672
Property(fc.oneof(fc.ascii(), fc.hexa()));6637.5399551812325;6773.106540461743;6822.325231314111;6173.359320113974;6793.150441927452
Property(fc.oneof(fc.ascii()@w=1, fc.hexa()@w=2));6620.707777522282;6826.732719618261;6848.9071644555;6188.857820599665;6811.179205770569
Property(fc.tuple(fc.ascii(), fc.hexa()));5591.338991557689;5732.956048316414;5628.108715147116;4769.334290500115;5620.433734452173
Property(fc.record({ascii: fc.ascii(), hexa: fc.hexa()}));4998.9653470581325;5196.395126358353;5085.764702645331;3259.229120883026;3730.4106814584056
Property(<tree-with-letrec>);3803.0473149849377;3939.5749607260545;3927.239703888455;3211.8998372209635;3924.9322719566976
Property(<comment-generator-letrec>);1556.3066388057107;2014.1549636665588;2072.7414528354952;1638.283290209101;1948.1625547746085
Property(fc.emailAddress());90.68470312414134;545.0664412900667;67.34428325700664;63.48823535114397;66.85401523635986
Property(fc.webUrl());1036.2893597688135;1087.7373236271112;128.25522566376557;121.35795424223436;127.6337978100818
Property(fc.integer().filter(() => true));7289.651626415587;7630.980835529307;7473.171362589766;6755.563176538369;7482.097861371339
Property(fc.integer().map(n => n));7427.1214038755725;7580.208155239358;7487.5363976730305;6706.4365882978;7485.075962078778
Property(fc.integer().chain(() => fc.integer()));5846.882654009587;6606.894717711384;6622.496843042132;6035.745152087014;6464.858775300357
Property(fc.integer().noBias());7711.755630397104;8245.109590988537;8121.772392186024;7174.682267202921;8179.607397606884
Property(fc.integer().noShrink());7351.885829207813;7775.402586503453;7573.814613002285;6936.520836124207;7622.12392319392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant