-
Notifications
You must be signed in to change notification settings - Fork 44
another example that uses KEY uint64, VALUE string #14
base: master
Are you sure you want to change the base?
Conversation
For the reference: another example that generates b-like package with static types, but also with staticly defined cmp function and adjusted kd: https://lab.nexedi.com/kirr/neo/blob/fcab58ca/go/zodb/storage/fs1/fsb/gen-fsbtree |
// $ go test -bench 1e3 example/all_kuint64vstring_test.go example/kuint64vstring.go | ||
// goos: linux | ||
// goarch: amd64 | ||
// BenchmarkSetSeq1e3-4 10000 131588 ns/op |
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 notice this benchmark is noticeable slower wrt the old ones on Go 1.7rc1 above. I wonder why. Do you know?
I also need to rerun the benchmarks again on the same machine (i5-4670 CPU @ 3.4GHz) with Go1.11.1. That will be possible only later this day. Of course, that does not block this PR.
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've done
==== jnml@r550:~/src/github.com/cznic/b> git checkout -b yozgatsi-master master
Switched to a new branch 'yozgatsi-master'
==== jnml@r550:~/src/github.com/cznic/b> git pull https://github.com/yozgatsi/b.git master
From https://github.com/yozgatsi/b
* branch master -> FETCH_HEAD
Updating 35e9bbe..4b08323
Fast-forward
CONTRIBUTORS | 1 +
doc.go | 28 +++-
example/all_kuint64vstring_test.go | 1227 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
example/kuint64vstring.go | 908 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 2162 insertions(+), 2 deletions(-)
create mode 100644 example/all_kuint64vstring_test.go
create mode 100644 example/kuint64vstring.go
==== jnml@r550:~/src/github.com/cznic/b> cd example/
/home/jnml/src/github.com/cznic/b/example
==== jnml@r550:~/src/github.com/cznic/b/example> make
go fmt
all_kuint64vstring_test.go
go test -i
go test
# github.com/cznic/b/example [github.com/cznic/b/example.test]
./kuint64vstring.go:14:2: kx redeclared in this block
previous declaration at ./int.go:14:7
./kuint64vstring.go:15:2: kd redeclared in this block
previous declaration at ./int.go:15:7
./kuint64vstring.go:29:2: btDPool redeclared in this block
previous declaration at ./int.go:29:2
./kuint64vstring.go:30:2: btEPool redeclared in this block
previous declaration at ./int.go:30:2
./kuint64vstring.go:31:2: btTPool redeclared in this block
previous declaration at ./int.go:31:2
./kuint64vstring.go:32:2: btXPool redeclared in this block
previous declaration at ./int.go:32:2
./kuint64vstring.go:35:6: btTpool redeclared in this block
previous declaration at ./int.go:35:6
./kuint64vstring.go:43:6: btEpool redeclared in this block
previous declaration at ./int.go:43:6
./kuint64vstring.go:58:2: Cmp redeclared in this block
previous declaration at ./int.go:58:2
./kuint64vstring.go:60:2: d redeclared in this block
previous declaration at ./int.go:60:2
./kuint64vstring.go:60:2: too many errors
FAIL github.com/cznic/b/example [build failed]
Makefile:15: recipe for target 'editor' failed
make: *** [editor] Error 2
==== jnml@r550:~/src/github.com/cznic/b/example>
I think the solution is to put your example in its own directory.
@navytux I noticed the 126 value for If the improvements are above noise level, I would like a PR from you for this change. Thanks. |
@cznic, I do not recall all the details now, but https://lab.nexedi.com/kirr/neo/commit/6793678b
It was definitely a measurable improvement, though a dedicated bulk-loading API would be much better. If it makes sense to you I could try to work on related PR, but it won't be fast. |
Please suggest the API. No promises above I'll consider it. Thanks.
Go forward if you like to at any pace. Just please tune I'm curious if setting |
Some time ago I was experimenting with trying to make Get/Set auto detect bulk retrieve/loading cases and optimize appripriately: https://lab.nexedi.com/kirr/b/compare/master...x/bulkload?expand_all_diffs=1 (scroll down to diffs) + If I recall correctly it was indeed ~ 8x faster, but regular random access got a bit (~5% IIRC) slower. That's why I did not posted my changes. I do not have a particular idea for dedicated bulk loading API for now as I'm not currently working on BTrees. Whenever/if I have a chance to come back to this topic I will try to speak up with the API proposal. About |
Okay, thanks for the input. |
Hi folks,
In case there is interest, wanted to share an example I created following your instructions and code.
Hope this is in line with your contribution process, let me know otherwise.
Best,
Tavit