Skip to content

Commit

Permalink
Merge pull request #384 from walmartlabs/hls/oct-2021-perf
Browse files Browse the repository at this point in the history
Performance improvements
  • Loading branch information
hlship committed Oct 29, 2021
2 parents d4c9067 + 719d774 commit 709138c
Show file tree
Hide file tree
Showing 22 changed files with 1,020 additions and 1,099 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 1.1 -- UNRELEASED

Fixed a tiny performance bug.
This release features some significant efficiency improvements inside Lacinia.

A small incompatible change is present: `com.walmartlabs.resolve/resolve-as` and `with-error` did, in prior releases,
support an argument that could be either a single error map, or a sequence of error maps. This was rarely used, and
has been changed: only a single error map is supported.

[Closed Issues](https://github.com/walmartlabs/lacinia/milestone/28?closed=1)

Expand Down
4 changes: 4 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
:exec-args
{:patterns [".*-tests?$"]}}

;; clj -Mdev:test:coverage
:coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.1"}}
:main-opts ["-m" "cloverage.coverage" "-p" "src" "-s" "test" "--codecov"]}

;; clj -Xdev:codox
:codox
{:extra-deps {codox/codox {:mvn/version "0.10.7"}}
Expand Down
11 changes: 6 additions & 5 deletions dev-resources/user.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
[com.walmartlabs.lacinia.schema :as schema]
[com.walmartlabs.lacinia :as l]
[clojure.spec.alpha :as s]
[com.walmartlabs.lacinia.trace :refer [set-compile-trace!
set-enable-trace!]]
[com.walmartlabs.lacinia.trace :as trace]
[expound.alpha :as expound]))

(require 'com.walmartlabs.lacinia.expound)
Expand All @@ -17,10 +16,12 @@
(comment
(do
(set! *warn-on-reflection* true)
(set-compile-trace! true)
(set-enable-trace! true))`
(trace/set-compile-trace! true)
(trace/set-enable-trace! true)
(add-tap clojure.pprint/pprint)
(trace/trace :msg "Tracing is enabled"))

(set-enable-trace! false)
(trace/set-enable-trace! false)

)

2 changes: 1 addition & 1 deletion docs/resolve/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Sticking with ``assoc-in`` or ``update-in`` is a good bet.
Warnings
--------

The ``with-error`` modifier function adds one or more errors to a result; in general, errors are
The ``with-error`` modifier function adds an error map to a result; in general, errors are
serious - Lacinia adds errors when it can't parse the GraphQL document, for example.

Lacinia adds a less dramatic level, a warning, via the ``with-warning`` modifier.
Expand Down
4 changes: 1 addition & 3 deletions docs/resolve/resolve-as.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ Field resolvers should not throw exceptions; instead, if there is a problem gene
they should use the :api:`resolve/resolve-as` function to return a ResolverResult value.

When using ``resolve-as``, you may pass the error map as the second parameter (which is optional).
You may pass a single error map, or a seq of error maps.
This first parameter is the resolved value, which may be ``nil``.

.. sidebar:: Why not just throw an exception?

Exceptions are a terrible way to deal with control flow issues, even in the
presence of actual failures.
More importantly, the ResolverResult approach allows more than a single error, and
works well with Lacinia's
More importantly, the ResolverResult approach works well with Lacinia's
:doc:`asynchronous processing features <async>`.

Errors will be exposed as the top-level ``:errors`` key of the execution result.
Expand Down
3 changes: 1 addition & 2 deletions docs/tutorial/rating-mutation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ A similar error would occur if the type of value provided to field argument is u
:type-name :Int}]}


.. [#errormaps] It can also be a seq of error maps, each containing,
at a minimum, a ``:message`` key.
.. [#errormaps] Each map must contain, at a minimum, a ``:message`` key.
.. [#jun2018] In June 2018 update to the GraphQL specification, the format of error maps in the result map
changed; when the tutorial upgrades to a version 0.29.0 of Lacinia, or later, the structure of the maps
in the ``:errors`` key will change somewhat.
189 changes: 15 additions & 174 deletions perf/benchmarks.csv
Original file line number Diff line number Diff line change
@@ -1,178 +1,4 @@
date,commit,kind,parse,exec
20170317,943c6a73,introspection,2.012646914847884,3.3982962869665516
20170317,943c6a73,basic,0.4995567324940618,0.24386081078478578
20170317,943c6a73,basic-vars,0.6335015917771085,0.25041553247955745
20170324,1b7f456c,introspection,2.0246591950333332,3.4602085544289043
20170324,1b7f456c,basic,0.5015100832206664,0.24973527992753625
20170324,1b7f456c,basic-vars,0.6428995111702128,0.25122130674037674
20170324,cae8f794,introspection,2.0250440356182797,3.178506137552083
20170324,cae8f794,basic,0.4980364009556764,0.24132741184534814
20170324,cae8f794,basic-vars,0.6358850933709745,0.24591709582839535
20170324,cae8f794,errors,0.23813962460006155,6.3390120183333325
20170405,a80faf29,introspection,0.6543270238577671,3.6908763826041673
20170405,a80faf29,basic,0.17480685048074604,0.3082739548832778
20170405,a80faf29,basic-vars,0.21454635765421312,0.2821693006210673
20170405,a80faf29,errors,0.08448592207588708,7.655755130725624
20170406,6a8bf077,introspection,0.635862530232335,2.7600789258663365
20170406,6a8bf077,basic,0.16274156894117647,0.22228896574861762
20170406,6a8bf077,basic-vars,0.1924813690964723,0.22592827092138973
20170406,6a8bf077,errors,0.08014362999269006,5.466662521391752
20170407,8e60a2ed,introspection,0.7002532445676054,3.301437358660131
20170407,8e60a2ed,basic,0.18587647459229648,0.2609091812126643
20170407,8e60a2ed,basic-vars,0.2348644941378546,0.294089609733833
20170407,8e60a2ed,errors,0.09775118402924153,6.650402228947368
20170413,8ff91bfa,introspection,0.6203485691505499,2.354235699033817
20170413,8ff91bfa,basic,0.16703035462757293,0.10339432218966696
20170413,8ff91bfa,basic-vars,0.1929599667118583,0.017023509707845403
20170413,8ff91bfa,errors,0.0820089686482393,1.939811850568182
20170419,7fa269f4,introspection,0.6640341612816765,2.6833458936834096
20170419,7fa269f4,basic,0.19122867837673774,0.11026182763600621
20170419,7fa269f4,basic-vars,0.21486359851360545,0.018091470474063464
20170419,7fa269f4,errors,0.08736230194302796,2.023105090442656
20170422,2af9d703,introspection,0.6823744206358494,2.350398771655702
20170422,2af9d703,basic,0.17915433768073466,0.1643014019049102
20170422,2af9d703,basic-vars,0.20002599782691577,0.17166675000814463
20170422,2af9d703,errors,0.08752418067882474,1.935915541004313
20170503,c15c49d2,introspection,0.6398522166761579,2.1359358759904374
20170503,c15c49d2,basic,0.15446018313507195,0.155760721958684
20170503,c15c49d2,basic-vars,0.19177848385591642,0.16079395124747312
20170503,c15c49d2,errors,0.07834705939561283,1.80311789912892
20170509,5648e562,introspection,0.6311865692112734,2.2037371287368424
20170509,5648e562,basic,0.1574481782301515,0.12619651248123354
20170509,5648e562,basic-vars,0.20527214630354204,0.13027058256709903
20170509,5648e562,errors,0.0827995381790328,1.9424965097912832
20170609,ac1d28d8,introspection,0.6275864847758407,2.245351424579832
20170609,ac1d28d8,basic,0.2028232124837598,0.14861733258243554
20170609,ac1d28d8,basic-vars,0.2194088225712251,0.16481260929939637
20170609,ac1d28d8,errors,0.09577290566262517,2.221037024041938
20170628,e1f6c319,introspection,0.6335017676370548,2.105733788647343
20170628,e1f6c319,basic,0.15859638220214717,0.16686643006225516
20170628,e1f6c319,basic-vars,0.1976290941992515,0.19043032107121835
20170628,e1f6c319,errors,0.0855946577044825,2.127239545167895
20170628,dcbbc5b0,introspection,0.6261888363636364,2.086958256944445
20170628,dcbbc5b0,basic,0.1572288971459343,0.1687671921443737
20170628,dcbbc5b0,basic-vars,0.19853708800773695,0.16982300546448087
20170628,dcbbc5b0,errors,0.0823011140422078,1.934420030612245
20170628,265ae0d7,introspection,0.6436009224318658,2.0682927872340424
20170628,265ae0d7,basic,0.16721160855263162,0.16787189669861555
20170628,265ae0d7,basic-vars,0.20296706513026053,0.1753103079861111
20170628,265ae0d7,errors,0.09229362361111111,1.8459698333333334
20170629,0b7c6c00,introspection,0.6134425264227643,2.4245138370370376
20170629,0b7c6c00,basic,0.1605089834384858,0.17934193844367016
20170629,0b7c6c00,basic-vars,0.19449734868017188,0.18267088488576452
20170629,0b7c6c00,errors,0.07991741077574796,2.0333664215686276
20170630,f189054f,introspection,0.6642270511982571,2.708165142857143
20170630,f189054f,basic,0.1701655428004535,0.19427971584699455
20170630,f189054f,basic-vars,0.20745193711967547,0.20200150123001234
20170630,f189054f,errors,0.08977535457809696,2.369415003787879
20170810,4efd6370,introspection,0.7733319143192489,2.044628705128205
20170810,4efd6370,basic,0.17040921896551725,0.1644649645769623
20170810,4efd6370,basic-vars,0.2023870945767196,0.18463529784213517
20170810,4efd6370,errors,0.08852463470728793,2.012542067251462
20170811,d5b3a0c9,introspection,0.6963101269315674,1.9540428427672956
20170811,d5b3a0c9,basic,0.16556149298540965,0.16194105711318796
20170811,d5b3a0c9,basic-vars,0.19718314326923078,0.16197249242424244
20170811,d5b3a0c9,errors,0.09071463654970761,1.698465322404372
20170925,c03a21aa,introspection,0.7953768532338309,2.225546669871795
20170925,c03a21aa,basic,0.19893028051865908,0.16563736154244307
20170925,c03a21aa,basic-vars,0.23000802685798383,0.1979764399449036
20170925,c03a21aa,errors,0.0961742208017677,1.7548755480225988
20180404,a48d8266,introspection,0.8013497910256411,2.1371578125000004
20180404,a48d8266,basic,0.1952080862928349,0.1562508818666667
20180404,a48d8266,basic-vars,0.23704274103139014,0.17224689705882354
20180404,a48d8266,errors,0.10118376152832677,1.7408687175141242
20180406,c6a8ae0c,introspection,0.7762351795865634,2.0891056836734694
20180406,c6a8ae0c,basic,0.18163522032374102,0.16208328705148206
20180406,c6a8ae0c,basic-vars,0.22812153936718174,0.16834670291048875
20180406,c6a8ae0c,errors,0.09980701877934274,1.743673563218391
20180406,4e0bb148,introspection,0.8490915040322582,2.1144770625000002
20180406,4e0bb148,basic,0.2040380874681934,0.16693300993022012
20180406,4e0bb148,basic-vars,0.24340073302107731,0.17630294884766726
20180406,4e0bb148,errors,0.10575082119914349,1.7491015327868855
20180406,bd78f23f,introspection,0.7687916145038168,2.0717392733333337
20180406,bd78f23f,basic,0.19161438783269963,0.159321993846977
20180406,bd78f23f,basic-vars,0.24351338217747953,0.17178624503488998
20180406,bd78f23f,errors,0.10168824277553765,1.689937204918033
20180607,a09684af,introspection,0.7654623430656935,2.0739769411764706
20180607,a09684af,basic,0.19411629945054945,0.15648809195402302
20180607,a09684af,basic-vars,0.23026943703703706,0.17102394789961814
20180607,a09684af,errors,0.10376084811165845,1.679861580729167
20180607,aa43f6cd,introspection,0.7762736706036747,2.209489857142857
20180607,aa43f6cd,basic,0.19135441078066917,0.16467518293333333
20180607,aa43f6cd,basic-vars,0.23051560125646714,0.17317753485103993
20180607,aa43f6cd,errors,0.1000561945268711,1.799648893678161
20180628,aff82ca1,introspection,0.8020529874686716,2.18706072962963
20180628,aff82ca1,basic,0.18979474344569291,0.17778643103448277
20180628,aff82ca1,basic-vars,0.23914217908653845,0.1842286823461092
20180628,aff82ca1,errors,0.10236992467789893,1.8303009363636367
20180712,62645b16,introspection,0.873151024590164,2.5135282195121955
20180712,62645b16,basic,0.19966221004993762,0.18709395092592593
20180712,62645b16,basic-vars,0.2567580453774385,0.2949545064102564
20180712,62645b16,errors,0.1832381930751174,2.856199311403509
20180921,1f21eafd,introspection,0.7697202768817205,2.3856991811594206
20180921,1f21eafd,basic,0.18568853951277484,0.17804521815476193
20180921,1f21eafd,basic-vars,0.2364529220973783,0.1951301018348624
20180921,1f21eafd,errors,0.10358288625904011,2.0267711800000003
20181112,a37c2a95,introspection,0.8408747549019608,2.4604320606060606
20181112,a37c2a95,basic,0.1927369382387707,0.1815748171948357
20181112,a37c2a95,basic-vars,0.2313205472411187,0.1816768367816092
20181112,a37c2a95,errors,0.1020452290809328,1.9566859033333337
20181113,a08a8670,introspection,0.7862167671957673,3.292235390151515
20181113,a08a8670,basic,0.1996443767584098,0.1857446525735294
20181113,a08a8670,basic-vars,0.23285157294028727,0.1862081381740196
20181113,a08a8670,errors,0.10003351717872483,1.9995173333333334
20181116,294bb8fb,introspection,0.8742471571815719,2.6669236666666665
20181116,294bb8fb,basic,0.19762099105367792,0.17624217619872906
20181116,294bb8fb,basic-vars,0.24236780306799335,0.17470750617283953
20181116,294bb8fb,errors,0.09468567351384999,1.9554895130718957
20181121,56f45c8e,introspection,0.79438922265625,2.5313622341269846
20181121,56f45c8e,basic,0.21221227462121214,0.17964686615732883
20181121,56f45c8e,basic-vars,0.23649218686868687,0.19735512935779817
20181121,56f45c8e,errors,0.10273439093137254,2.13847756122449
20190117,3698196f,introspection,1.099346496491228,3.424941583333333
20190117,3698196f,basic,0.26255996522476677,0.2485488133333333
20190117,3698196f,basic-vars,0.3249136149614961,0.27607138457987074
20190117,3698196f,errors,0.1363617680860806,2.7781978657407413
20190429,f80fcd8a,introspection,1.146577903409091,3.7215981130952382
20190429,f80fcd8a,basic,0.27839251621621625,0.2660892153153153
20190429,f80fcd8a,basic-vars,0.38085694504181605,0.2938037803692906
20190429,f80fcd8a,errors,0.15599546910695744,3.0463668774509802
20190909,ade51754,introspection,0.8159867748756219,2.9722731851851854
20190909,ade51754,basic,0.20399955936920225,0.19009182703836933
20190909,ade51754,basic-vars,0.2549549075342466,0.20904171477663233
20190909,ade51754,errors,0.10873773872984535,2.375951570370371
20191015,6a6427b1,introspection,0.789799125925926,4.530104217391305
20191015,6a6427b1,basic,0.19689808219623134,0.31371225733752617
20191015,6a6427b1,basic-vars,0.24130035416666668,0.32020349659863945
20191015,6a6427b1,errors,0.10140378373015874,4.397218044871795
20191015,30f432d7,introspection,0.8173556395348838,4.690449743055556
20191015,30f432d7,basic,0.20995595213849286,0.3464613822843823
20191015,30f432d7,basic-vars,0.2611538304239402,0.39547917738095245
20191015,30f432d7,errors,0.10682754319105693,4.5827220902777785
20191015,a8f70960,introspection,0.894046179063361,3.7307601494252873
20191015,a8f70960,basic,0.22867179435783225,0.318652981968811
20191015,a8f70960,basic-vars,0.2544327581543357,0.32432679556898286
20191015,a8f70960,errors,0.11418682908163265,3.4744433645833337
20191018,e636532b,introspection,0.8179061539440204,3.69203785
20191018,e636532b,basic,0.20734128336436997,0.3007085900383142
20191018,e636532b,basic-vars,0.2557128186528497,0.3076740357142857
20191018,e636532b,errors,0.1050049043743642,3.8213080172413796
20191022,baddeb37,introspection,0.8240670681818183,2.826543012820513
20191022,baddeb37,basic,0.20447634597471726,0.26721781424936386
20191022,baddeb37,basic-vars,0.2566161245915033,0.2766042983592401
20191022,baddeb37,errors,0.1149299822767553,2.4908974496124032
20191023,aba8caed,introspection,0.8075012340966923,2.611043575
20191023,aba8caed,basic,0.19365356116504856,0.25838496882494005
20191023,aba8caed,basic-vars,0.2491914072289157,0.27567762260034906
20191023,aba8caed,errors,0.10989653663940013,2.369603662790698
20191023,1ba5a5af,introspection,0.8928384203539824,2.930119365740741
20191023,1ba5a5af,basic,0.233668026622903,0.2777339164432529
20191023,1ba5a5af,basic-vars,0.2693419582233949,0.2880145408357075
20191023,1ba5a5af,errors,0.11999307990083906,2.427930503787879
20191108,3f4b74c5,introspection,0.8201439475806453,2.5875651875
20191108,3f4b74c5,basic,0.19787825118805158,0.2753075021588946
20191108,3f4b74c5,basic-vars,0.24985922033898306,0.25837978818565405
20191108,3f4b74c5,errors,0.104934924894958,2.421029972222222
20200206,c2a99358,introspection,0.8727988839999999,2.396426222222222
20200206,c2a99358,basic,0.20375819215686278,0.22516588500388504
20200206,c2a99358,basic-vars,0.24340475835370826,0.23598190314136128
Expand Down Expand Up @@ -282,3 +108,18 @@ date,commit,kind,parse,exec
20211011,515a811c,basic,0.17240482289855075,0.18718643345771144
20211011,515a811c,basic-vars,0.2085074494750656,0.2003992530625403
20211011,515a811c,errors,0.08955015955903685,4.5589808939393945
20211028,a8f1174d,introspection,0.7319686809523809,1.4824524904761904
20211028,a8f1174d,deep,1.3760610355555558,7.318374047619048
20211028,a8f1174d,basic,0.18664341813898708,0.15217010476190476
20211028,a8f1174d,basic-vars,0.21367459665955937,0.1603980940728657
20211028,a8f1174d,errors,0.09907044270833334,3.574464094444444
20211028,0b564fcc,introspection,0.6444108514957265,1.9328515061728397
20211028,0b564fcc,deep,1.1664587681992336,7.406286535714285
20211028,0b564fcc,basic,0.1598326126198083,0.1530723049382716
20211028,0b564fcc,basic-vars,0.1905723289224953,0.16518760092744136
20211028,0b564fcc,errors,0.08489806253466446,3.5629784333333334
20211029,20095c09,introspection,0.7071201221461187,1.3790615949367089
20211029,20095c09,deep,1.3235376131687244,7.999571226190477
20211029,20095c09,basic,0.173101540765391,0.13581221989528794
20211029,20095c09,basic-vars,0.23765225940860218,0.15242919057971016
20211029,20095c09,errors,0.09199271510747806,3.186511141414142

0 comments on commit 709138c

Please sign in to comment.