BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
mruby can be more lightweight
1. mruby can be more
lightweight
2018-06-01 RubyKaigi 2018
Yurie Yamane
Team Yamanekko
2. About me
• yurie yamane
• Team yamanekko
• GitHub: https://github.com/yamanekko
• Qiita: https://qiita.com/yamanekko
• a member of Toppers project
• a staff of SWEST
(Summer Workshop on Embedded System Technologies)
https://swest.toppers.jp/
TOPAME
matz
3. About me
• smaller mruby
• low cost microcomputer
• IDE for mruby(VS Code)
• porting nomitory to VS Code
• DEMO
• mruby for ET robot contest
sponsors
wanted!
21. Ruby method to C function
• Ex.String class
String class
to_i mrb_str_to_i
upcase mrb_str_upcase
length mrb_str_size
reverse mrb_str_reverse
size mrb_str_size
mrb_define_method(mrb, a, "size",mrb_str_size, MRB_ARGS_NONE());
22. Ruby method to C function
• perf
method name id
to_i 290
upcase 298
length 212
reverse 259
size 271
id function name
290 mrb_str_to_i
298 mrb_str_upcase
212 mrb_str_size
259 mrb_str_reverse
271 mrb_str_size
23. extract symbols
• *.c
• intern literal
• method
• const
• global const
• class
• module
• class method
• *.rb
• def
• class
mrb_intern_lit(mrb, "to_a")
mrb_define_class(mrb, "Array", mrb->object_class);
mrb_define_method(mrb, a, "+", mrb_ary_plus, MRB_ARGS_REQ(1));
mrb_define_method(mrb, a, "size",mrb_ary_size, MRB_ARGS_NONE());
class Foo
def foo
(...)
end
end
30. • MRB_USE_ETEXT_EDATA
mrbconf.md
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code
*/
} >FLASH
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
31. • MRB_HEAP_PAGE_SIZE
• Specifies number of `RBasic` per each heap
page.
• MRB_WORD_BOXING
• If defined represent `mrb_value` as a word.
• If defined `Float` will be a mruby object with
`RBasic`.
• MRB_STR_BUF_MIN_SIZE
• Specifies initial capacity of `RString` created
by `mrb_str_buf_new` function. mrbconf.md