ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:72532] Re: [Ruby trunk - Feature #11339] [PATCH] io.c: avoid kwarg parsing in C API
Date: Mon, 28 Dec 2015 01:12:42 +0000
Message-ID: <20151228011242.GA22699@dcvr.yhbt.net> (raw)
In-Reply-To: <redmine.journal-55795.20151228001354.aca73869639c5e5c@ruby-lang.org>

headius@headius.com wrote:
> Eric Wong wrote:
> >  Using globals or TLS would introduce subtle reentrancy problems
> >  when calls are nested.  I don't want to create more C-APIs
> >  we need to support long-term, either.

> The global would only be used between the runtime making a call with
> keyword arguments and the consumption of those arguments for variable
> initialization in a C method. There's no nesting of calls, and once
> the C method has consumed the values in the global (i.e. immediately
> before doing anything else), it is not touched until the next call
> with keywords from Ruby to C.

The current rb_get_kwargs() calls may be delayed until the keyword is
actually needed (to avoid unnecessary hash lookups).

Anyways, if somebody can design a good API for internal use,
we can use it.  Current rb_get_kwargs() and even rb_scan_args()
are inefficient and even error-prone:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/68507

> >  Fwiw, I like the Rubinius philosophy of using Ruby as much as
> >  possible a lot and tried to contribute there back in the day.
> 
> Yes, except that this doesn't buy anything because 99% of the logic of
> these methods still lives within C code. If you were also moving the
> body of these nonblock methods into Ruby, I'd see some value. You've
> removed a couple lines of C and added a couple lines of Ruby. And now
> there's going to be an extra method in stack traces and an extra Ruby
> frame allocated for every call.

It's still a work-in-progress, obviously; but the current state
already speeds things up for `exception: false' users.
Implementation details will change, of course; but we need
freedom to change them by having a smaller public C API.

  reply	other threads:[~2015-12-28  0:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11339.20150707215946@ruby-lang.org>
2015-07-07 21:59 ` [ruby-core:69892] [Ruby trunk - Feature #11339] [Open] " normalperson
2015-07-15 19:41   ` [ruby-core:69983] " Eric Wong
2015-07-16  3:46     ` [ruby-core:69990] " SASADA Koichi
2015-07-16  7:01       ` [ruby-core:69995] " Eric Wong
2015-07-16  9:17         ` [ruby-core:69999] " SASADA Koichi
2015-10-09 23:35           ` [ruby-core:71035] " Eric Wong
2015-11-10 22:27   ` [ruby-core:71435] " Eric Wong
2015-12-02  2:23   ` [ruby-core:71789] " Eric Wong
2015-11-11  5:20 ` [ruby-core:71439] [Ruby trunk - Feature #11339] " matz
2015-11-12  2:03   ` [ruby-core:71459] " Eric Wong
2015-11-12  9:53     ` [ruby-core:71462] " Eric Wong
2015-11-18  2:07     ` [ruby-core:71539] " Eric Wong
2015-11-13  4:18   ` [ruby-core:71473] " Eric Wong
2015-11-13  5:46     ` [ruby-core:71478] " SASADA Koichi
2015-11-13  7:03       ` [ruby-core:71479] " Eric Wong
2015-12-27 22:49 ` [ruby-core:72527] " headius
2015-12-27 23:00 ` [ruby-core:72528] " headius
2015-12-27 23:40   ` [ruby-core:72529] " Eric Wong
2015-12-28  0:13 ` [ruby-core:72530] " headius
2015-12-28  1:12   ` Eric Wong [this message]
2015-12-28  0:22 ` [ruby-core:72531] " headius
2015-12-28  1:50 ` [ruby-core:72535] " headius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151228011242.GA22699@dcvr.yhbt.net \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ruby-core@ruby-lang.org archive (unofficial mirror)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/ruby-core

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 ruby-core ruby-core/ https://public-inbox.org/ruby-core \
		ruby-core@ruby-lang.org
	public-inbox-index ruby-core

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.core
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.core
	nntp://news.gmane.io/gmane.comp.lang.ruby.core
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/ruby.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git