C API to create BigDecimal objects
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the linked Trilogy contrib/ruby/ext/trilogy-ruby/cast.c conversion code at lines 236-241 and trace how it currently creates BigDecimal values. The requested API should accept a byte string and length; done means C clients can create BigDecimal objects without allocating an intermediate Ruby String or calling BigDecimal through rb_funcall.
Written by the indexing model from the issue text.
Description
BigDecimal is used by various database clients, as well as various serialization libraries. Many of those are implemented in C, and for them creating BigDecimal objects is an important bottleneck.
For example, here's the relevant code in the Trilogy MySQL client gem: https://github.com/trilogy-libraries/trilogy/blob/7fcfe8c1c79208c6c56439d1d29c7dc591442c53/contrib/ruby/ext/trilogy-ruby/cast.c#L236-L241
It needs to:
- Allocate a Ruby String and cpy the bytes into it.
- Use
rb_funcallto invokeBigDecimal().
The string allocation isn't too bad, but having to use method dispatch is quite costly.
It would be very useful if there was a set of C APIs to efficiently allocate BigDecimal objects:
VALUE BigDecimal_from_str(const char *, size_t len)`
- Dominant language
- C
- Stars
- 152
- Forks
- 99
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/bigdecimal
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
ruby/bigdecimal#569 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
ruby/bigdecimal#566 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
ruby/bigdecimal#491 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
ruby/bigdecimal#444 · 1 comment ·
Maintainers usually reply within 1 day
-
BigDecimal#whole?Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
ruby/bigdecimal#291 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
HTTP Request Smuggling: non-final chunked Transfer-Encoding not rejected (CWE-444)Possibly taken @code1a2024 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jaredgei/wow-forever-android#97 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
openziti/ziti-sdk-c#1254 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
flatpak/xdg-desktop-portal#2215 ·
Maintainers usually reply within 2 days
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existPossibly taken A pull request linked to this issue is open or already merged. Openarea:http kind:gate-defect
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
InauguralSystems/EigenScript#2397 ·
Maintainers usually reply within 1 day