12 Commits

Author SHA1 Message Date
Ice3man
8f313629b8
Memory usage optimizations (#2350)
* Replaced strings.Replaced with fasttemplate reducing allocations

Custom template parsing logic was replaced with fasttemplate package for reducing
allocations in the replacer.Replace hotpath leading to allocation reduction which
accounted for 30% of total nuclei allocations.

$ go test -bench=. -benchmem
goos: darwin
goarch: arm64
pkg: github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/replacer
BenchmarkReplacer-8               837232              1422 ns/op            2112 B/op         31 allocs/op
BenchmarkReplacerNew-8           3672765               320.3 ns/op            48 B/op          4 allocs/op

* Fixed tests failing

* Use pre-compiled map of DSL expressions

* Reworked expression parsing logic to reduce memory allocations

$ go test -bench=. -benchmem
goos: darwin
goarch: arm64
pkg: github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/expressions
BenchmarkEvaluate-8        31560             37769 ns/op           31731 B/op        265 allocs/op
BenchmarkEvaluateNew-8       109144              9621 ns/op            6253 B/op        116 allocs/op
2022-08-23 13:16:41 +05:30
Mzack9999
72c5c399ec adding support for dsl extractors 2022-04-20 11:32:13 +02:00
LuitelSamikshya
2856e7e247
Extractor + Headless Actions structures to enums (#1217)
* enum support for extractor
2021-11-19 01:41:10 +05:30
Ice3man543
90a0502b60 Misc fixes to default part 2021-11-11 17:30:25 +05:30
Alexey Zhuchkov
3a47413cd4 Add case-insensitive flag to matchers and extractors 2021-10-29 19:08:23 +03:00
forgedhallpass
0ce33927c7 Typo fixes. 2021-09-07 17:31:46 +03:00
seb
d2e7cca17b fix golint 2021-08-01 14:42:04 +02:00
seb
3529cfa1d6 json extractor support 2021-07-31 22:49:23 +02:00
Ice3man543
2ea6e7699a Added tests for DNS package 2021-02-03 02:09:45 +05:30
Ice3man543
50eafb29d1 Bugfix: kval extractor not working 2021-01-12 11:21:32 +05:30
Ice3man543
5153647e0f Misc work on extractors + compat 2020-12-24 12:13:18 +05:30
Ice3man543
d631074e35 Separating matchers, extractors and requests as protocols and operators 2020-12-21 14:31:32 +05:30