Ran
|
Jobs
1
|
Files
21
|
Run time
2s
|
Badge
Embed ▾
README BADGES
|
travis-ci
Renderer allows re-use of a passed in Locale object instead of reload Ref #53 CiteProc::Ruby::Engine class already does it here for styles: https://github.com/inukshuk/citeproc-ruby/blob/<a class=hub.com/inukshuk/citeproc-ruby/commit/<a class="double-link" href="https://git"><a class=hub.com/inukshuk/citeproc-ruby/commit/c6b81ea04868ad2afc704d9a38148df053cf4898">c6b81ea04/lib/citeproc/ruby/engine.rb#L117-L121 And CiteProc::Ruby::Format does it here for formats: https://github.com/inukshuk/citeproc-ruby/blob/c6b81ea04868ad2afc704d9a38148df053cf4898/lib/citeproc/ruby/format.rb#L31 Loading (or not) of all three types of objects is done in kind of different non-parallel ways, but that was kind of there in the code when I found it. With this change for locale, I can avoid loading both locales AND styles (as well as formats while we’re at it although it probably doesn’t make as much of a difference) with EITHER of these APIs: ```ruby csl_style # assume exists a CSL::Style, prob previously loaded with CSL::Style.load csl_locale # assume exists a CSL::Style, prob previously loaded with CSL::Locale.load cp = CiteProc::Processor.new style: csl_style, locale: csl_locale, format: CiteProc::Ruby::Formats::Html.new cp.import csl cp.render :bibliography, id: whatever csl_hash # assume exists, a single hash (not array) that’s csl-data.json format citation_item = CiteProc::CitationItem.new(id: csl_hash[“id"]) do |c| c.data = CiteProc::Item.new(csl) end renderer = CiteProc::Ruby::Renderer.new :format => CiteProc::Ruby::Formats::Html.new, :style => csl_style, :locale => csl_locale renderer.render citation_item, csl_style.bibliography ``` The latter is giving me pretty good performance, 7-9ms on my macbook, with already loaded style/locale. The former still gives better performance than it did before an already loaded locale could be used. There’s other code here: https://github.com/inukshuk/citeproc-ruby/blob/c6b81ea04868ad2afc704d9a38148df053cf4898/lib/citeproc/ruby/renderer/locale.rb#L11 …that at first I was looking at to avoid t... (continued)
2 of 2 new or added lines in 1 file covered. (100.0%)
897 of 945 relevant lines covered (94.92%)
101.42 hits per line
ID | Job ID | Ran | Files | Coverage | |
---|---|---|---|---|---|
1 | 188.1 (2.4, WITH_COVERALLS=true) | 21 |
94.92 |
Travis Job 188.1 |
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|