[前][次][番号順一覧][スレッド一覧]

ruby-changes:36891

From: nobu <ko1@a...>
Date: Wed, 24 Dec 2014 20:38:37 +0900 (JST)
Subject: [ruby-changes:36891] nobu:r48972 (trunk): dir.c: glob performance

nobu	2014-12-24 20:38:21 +0900 (Wed, 24 Dec 2014)

  New Revision: 48972

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48972

  Log:
    dir.c: glob performance
    
    * dir.c (glob_make_pattern): restrict searching case-insensitive
      name from the filesystem to only last part, for the performance.
      [ruby-core:63591] [ruby-core:63591]

  Modified files:
    trunk/ChangeLog
    trunk/dir.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48971)
+++ ChangeLog	(revision 48972)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 24 20:38:16 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* dir.c (glob_make_pattern): restrict searching case-insensitive
+	  name from the filesystem to only last part, for the performance.
+	  [ruby-core:63591] [ruby-core:63591]
+
 Wed Dec 24 18:21:27 2014  Koichi Sasada  <ko1@a...>
 
 	* gc.c: remove unused rb_objspace_t::rgengc::old_objects_at_gc_start.
Index: dir.c
===================================================================
--- dir.c	(revision 48971)
+++ dir.c	(revision 48972)
@@ -1241,7 +1241,8 @@ glob_make_pattern(const char *p, const c https://github.com/ruby/ruby/blob/trunk/dir.c#L1241
 	else {
 	    const char *m = find_dirsep(p, e, flags, enc);
 	    const enum glob_pattern_type magic = has_magic(p, m, flags, enc);
-	    const enum glob_pattern_type non_magic = (HAVE_HFS || FNM_SYSCASE) ? PLAIN : ALPHA;
+	    const enum glob_pattern_type non_magic =
+		((HAVE_HFS || FNM_SYSCASE) && (m == e || (m+1 == e && *m == '/'))) ? PLAIN : ALPHA;
 	    char *buf;
 
 	    if (!(FNM_SYSCASE || magic > non_magic) && !recursive && *m) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]