小编tyc*_*oon的帖子

为什么我在 CentOS 7 上编译 Ruby 3.2 时出错?

我尝试使用 rbenv 的 ruby​​-build 插件构建 Ruby 3.2,但遇到一些奇怪的编译错误:

\n
compiling bignum.c\nIn file included from vm_core.h:164:0,\n                 from iseq.h:14,\n                 from mini_builtin.c:3,\n                 from miniinit.c:51:\nthread_pthread.h:109:39: error: expected \xe2\x80\x98=\xe2\x80\x99, \xe2\x80\x98,\xe2\x80\x99, \xe2\x80\x98;\xe2\x80\x99, \xe2\x80\x98asm\xe2\x80\x99 or \xe2\x80\x98__attribute__\xe2\x80\x99 before \xe2\x80\x98struct\xe2\x80\x99\n RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;\n                                       ^\nIn file included from iseq.h:14:0,\n                 from mini_builtin.c:3,\n                 from miniinit.c:51:\nvm_core.h: In function \xe2\x80\x98rb_current_execution_context\xe2\x80\x99:\nvm_core.h:1864:34: error: \xe2\x80\x98ruby_current_ec\xe2\x80\x99 undeclared (first use in this function)\n     rb_execution_context_t *ec = ruby_current_ec;\n                                  ^\nvm_core.h:1864:34: note: each undeclared identifier is reported only once for each function it appears in\n
Run Code Online (Sandbox Code Playgroud)\n

这是完整的日志:https://gist.github.com/tycooon/c077a1d99299469bd86131211c565ff7

\n

Ruby …

c ruby linux centos7

11
推荐指数
1
解决办法
2231
查看次数

MongoDB中的慢速regexp查询

我在一个带有索引"名称"字段的集合中有150万个文档.查询db.things.find({name: /^foo/i})大约需要5秒,这非常慢.具有相同记录的类似MySQL表SELECT * FROM things WHERE name LIKE 'foo%'在不到10毫秒内执行.

mongo的解释:

db.things.find({name: /^foo/i}).limit(10).explain()
{
    "cursor" : "BtreeCursor name_1 multi",
    "nscanned" : 325730,
    "nscannedObjects" : 10,
    "n" : 10,
    "millis" : 4758,
    "nYields" : 89,
    "nChunkSkips" : 0,
    "isMultiKey" : false,
    "indexOnly" : false,
    "indexBounds" : {
        "name" : [
            [
                "",
                {

                }
            ],
            [
                /^foo/i,
                /^foo/i
            ]
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

那么,正则表达式查询在蒙戈慢还是我做错了?

regex mongodb

5
推荐指数
1
解决办法
1474
查看次数

标签 统计

c ×1

centos7 ×1

linux ×1

mongodb ×1

regex ×1

ruby ×1