faster_path 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18f4ed53458f5dc7d5c2b0d0433edf7444594bdb
4
- data.tar.gz: 1add8d70b9d3e4c147f405b831ff224ce0520c98
3
+ metadata.gz: 12559a70086221b3a9d8bad4dd21a390bedd7672
4
+ data.tar.gz: 7a2924fd52a79a8fed10f83f49b2b262bb1fca58
5
5
  SHA512:
6
- metadata.gz: bb708638714c8023d0ce1273607fdc7ba86f9a9b95652a05611a56c21165b8b9c2b90fdc8634a116e290287a5969a42a3ca85f93223a180844961d3b6f429cfb
7
- data.tar.gz: 67dc584c6122448af7bfad7ae9a1c9329b6c79f6ff08c9e7a95f1bfe486ac80fc16542528a502555d6a62fb085c8bf4c1f358d59f65c9f63b9ab162d2fbd971d
6
+ metadata.gz: 8c8af46b6547dfe4676eb51797d2cd1768dd898e21b3b88c67214814600660bd498b81fe05408431a956fff3fc5080b527875637a49069c57e33cb2b9c218203
7
+ data.tar.gz: 407d21b3b56b670b3351d712bd4726805e2f53cf1d47f6f6074d50884c1d09ee45c11cc27ef231e2c2c0192eb11671dcd3ee1b21565b0e4756b2a273246d210b
data/.gitignore CHANGED
@@ -8,5 +8,5 @@
8
8
  /pkg/
9
9
  /spec/reports/
10
10
  /tmp/
11
- priority-methods.txt
12
11
  mkmf.log
12
+ **/*.swp
data/.travis.yml CHANGED
@@ -1,5 +1,13 @@
1
- sudo: false
1
+ sudo: true
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.2.5
4
5
  - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
6
+ env:
7
+ - TEST_REFINEMENTS=true
8
+ - TEST_REFINEMENTS=false
9
+ before_install:
10
+ - gem install bundler -v 1.12.5
11
+ - curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
12
+ - bundle && bundle exec rake build_src && rake clean_src
13
+ script: bundle exec rake test
data/README.md CHANGED
@@ -1,21 +1,59 @@
1
1
  # FasterPath
2
+ [![Gem Version](https://badge.fury.io/rb/faster_path.svg)](https://badge.fury.io/rb/faster_path)
3
+ [![Build Status](https://travis-ci.org/danielpclark/faster_path.svg?branch=master)](https://travis-ci.org/danielpclark/faster_path)
2
4
 
3
- This project "WILL BE" a rewrite of Ruby's STDLIB **Pathname** optimized for speed and performance.
4
- I am considering making it a \*nix OS gem, but that may likely just be an early phase. Windows support
5
- can be added much later.
6
-
7
- The primary **GOAL** of this project is to improve performance in the Rails environment as path relation
8
- and file lookup is a huge bottleneck in performance. As this is the case the path performance updates
9
- will likely not be limited to just changing Pathname but also will be offering changes in related methods
10
- and classes.
5
+ The primary **GOAL** of this project is to improve performance in the most heavily used areas of Ruby as
6
+ path relation and file lookup is currently a huge bottleneck in performance. As this is the case the
7
+ path performance updates will likely not be limited to just changing the Pathname class but also will
8
+ be offering changes in related methods and classes.
11
9
 
12
10
  Users will have the option to write their apps directly for this library, or they can choose to either
13
- refine or monkeypatch the existing library. Refinements are narrowed to scope and monkeypatching will
11
+ refine or monkeypatch the existing standard library. Refinements are narrowed to scope and monkeypatching will
14
12
  be a sledge hammer ;-)
15
13
 
16
14
  **NOTE**: Refinements and monkeypatch methods are highly likely to be changed and renamed pre version
17
15
  0.1.0 so keep that in mind!
18
16
 
17
+ ## Why
18
+
19
+ I did a check on Rails on what methods were being called the most and where the application spend
20
+ most of its time. It turns out roughly 80% _(as far as I can tell)_ of the time spent and calls made
21
+ are file Path handling. This is shocking, but it only gets worse when handling assets. **That is
22
+ why we need to deal with these load heavy methods in the most efficient manner!**
23
+
24
+ Here's a snippet of a Rails stack profile with some of the most used and time expensive methods.
25
+
26
+ ```
27
+ Booting: development
28
+ Endpoint: "/"
29
+ user system total real
30
+ 100 requests 26.830000 1.780000 28.610000 ( 28.866952)
31
+ Running `stackprof tmp/2016-06-09T00:42:10-04:00-stackprof-cpu-myapp.dump`. Execute `stackprof --help` for more info
32
+ ==================================
33
+ Mode: cpu(1000)
34
+ Samples: 7184 (0.03% miss rate)
35
+ GC: 1013 (14.10%)
36
+ ==================================
37
+ TOTAL (pct) SAMPLES (pct) FRAME
38
+ 1894 (26.4%) 1894 (26.4%) Pathname#chop_basename
39
+ 1466 (20.4%) 305 (4.2%) Pathname#plus
40
+ 1628 (22.7%) 162 (2.3%) Pathname#+
41
+ 234 (3.3%) 117 (1.6%) ActionView::PathResolver#find_template_paths
42
+ 2454 (34.2%) 62 (0.9%) Pathname#join
43
+ 57 (0.8%) 52 (0.7%) ActiveSupport::FileUpdateChecker#watched
44
+ 760 (10.6%) 47 (0.7%) Pathname#relative?
45
+ 131 (1.8%) 25 (0.3%) ActiveSupport::FileUpdateChecker#max_mtime
46
+ 88 (1.2%) 21 (0.3%) Sprockets::Asset#dependency_fresh?
47
+ 18 (0.3%) 18 (0.3%) ActionView::Helpers::AssetUrlHelper#compute_asset_extname
48
+ 108 (1.5%) 14 (0.2%) ActionView::Helpers::AssetUrlHelper#asset_path
49
+ ```
50
+
51
+ ## Status
52
+
53
+ * Rust compilation is working
54
+ * Methods are _most likely_ stable
55
+ * Testers and developers are most welcome!
56
+
19
57
  ## Installation
20
58
 
21
59
  Ensure Rust is installed:
@@ -44,11 +82,11 @@ Or install it yourself as:
44
82
 
45
83
  Current methods implemented:
46
84
 
47
- |Rust Implementation|Ruby Implementation|Performance Improvemant|
48
- |---|---|---|
49
- | `FasterPath.absolute?` | `Pathname#absolute?` | 545% to 1450% |
50
- | `FasterPath.chop_basename` | `Pathname#chop_basename` | 6.7% to 54.6% |
51
- | FasterPath.blank? | | |
85
+ |FasterPath Rust Implementation|Ruby 2.3.1 Implementation|Performance Improvement|
86
+ |---|---|:---:|
87
+ | `FasterPath.absolute?` | `Pathname#absolute?` | 1234.6% |
88
+ | `FasterPath.chop_basename` | `Pathname#chop_basename` | 27.5% |
89
+ | `FasterPath.blank?` | | |
52
90
 
53
91
  You may choose to use the methods directly, or scope change to rewrite behavior on the
54
92
  standard library with the included refinements, or even call a method to monkeypatch
@@ -64,7 +102,7 @@ require "faster_path/optional/refinements"
64
102
  using FasterPath::RefinePathname
65
103
  ```
66
104
 
67
- And for the sldeghammer of monkey patching you can do
105
+ And for the sledgehammer of monkey patching you can do
68
106
 
69
107
  ```
70
108
  require "faster_path/optional/monkeypatching"
@@ -1,3 +1,3 @@
1
1
  module FasterPath
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/faster_path.rb CHANGED
@@ -28,7 +28,10 @@ module FasterPath
28
28
  private
29
29
  module Rust
30
30
  extend FFI::Library
31
- ffi_lib 'target/release/libfaster_path.so'
31
+ #ffi_lib 'target/release/libfaster_path.so'
32
+ ffi_lib begin
33
+ "#{File.expand_path("../target/release/", File.dirname(__FILE__))}/libfaster_path.#{FFI::Platform::LIBSUFFIX}"
34
+ end
32
35
  attach_function :is_absolute, [ :string ], :bool
33
36
  attach_function :is_blank, [ :string ], :bool
34
37
  attach_function :basename, [ :string ], :string
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faster_path
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark