尝试在OSX El Capitan升级后安装thift gem:
$ gem install thrift
Building native extensions. This could take a while...
ERROR: Error installing thrift:
ERROR: Failed to build gem native extension.
/Users/foo/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20160402-32256-7dzqel.rb extconf.rb
checking for strlcpy() in string.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf)));
^~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)
使用compact_protocol.c进行编译失败:442:41:错误:移位负有符号值未定义[-Werror,-Wshift-negative-value]
为什么这些基准测试结果如此不同?
func Benchmark1(b *testing.B) {
for n := 0; n < b.N; n++ {
_ = make([]byte, 8)
}
}
func Benchmark2(b *testing.B) {
length := 1
for n := 0; n < b.N; n++ {
_ = make([]byte, 7+length)
}
}
Run Code Online (Sandbox Code Playgroud)
基准测试结果:
Benchmark1-8 500000000 3.37 ns/op
Benchmark2-8 30000000 50.6 ns/op
Run Code Online (Sandbox Code Playgroud) 我有一个具有以下映射的字段:
birthdate: { type: :date, format: :dateOptionalTime }
Run Code Online (Sandbox Code Playgroud)
对此的查询是什么?
elasticsearch elasticsearch-mapping elasticsearch-dsl elasticsearch-query