Closed crazy4groovy closed 6 years ago
Hey, thanks!
I hadn't looked into perf too much yet but this makes sense to me and as good of a place to start as any. So three questions:
Maybe at node[2].reduce(clense, []).map(build(x, y, z))
the build(x, y, z)
could be cached?
Not sure if that's possible though..
Sounds like a good time to first put tests in place ;)
@crazy4groovy if you are talking about simple unit tests for functional regression testing you're welcome to use my own library Tead.
For performance testing, I have less knowledge regarding which tools to use.
Hahaa, I am a small way through implementing these.. in Tead like @okwolf suggested! There is only a simple set to start off with. I will push them up after work this evening.
@lukejacksonn welcome to the (somewhat exclusive) Tead club! Let me know how your experience is using it, and what you'd like improved.
I have added tests to the repo 🔬 which means you can now play in (relative) safety 🎉
I tried running the code you provided @crazy4groovy and it doesn't pass the tests. I thinks the problem is it doesn't supporting the unwrapping of arrays in children arrays; like this:
[ 'main', [
'Hello World',
[['li', 1],['li', 2],['li', 3]],
]]
Which makes returning a map possible without having to spread it into the parents children array:
const Item = x => ['li', x]
['main', [
'Hello World',
[1,2,3].map(Item),
]]
That could be fixed with some tweaking but again, it is hard to know the actual benefits until we write some perf tests for it too. This can't be too hard but I have never actually done it so might take some time.
Advice welcomed!
Fixed by #17 thanks @crazy4groovy
Cool lib!
What about
or maybe?
to save some memory via mutating?