commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stain <...@git.apache.org>
Subject [GitHub] commons-rdf pull request #27: COMMONSRDF-47 RDFSyntax as an interface
Date Thu, 12 Jan 2017 17:32:48 GMT
Github user stain commented on a diff in the pull request:

    https://github.com/apache/commons-rdf/pull/27#discussion_r95843006
  
    --- Diff: simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.java
---
    @@ -240,7 +240,7 @@ public T rdfTermFactory(RDF rdfTermFactory) {
         public T contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException {
             AbstractRDFParser<T> c = clone();
    --- End diff --
    
    No, but cloning means the `RDFParser` is immutable and can be reused in a thread-safe
manner, e.g. if parsing many Turtle files in the same folder. So what is worse..:
    
    * a) Creating 1000 RDFParser instances, setting all parameters every time, and remember
not to reuse/share in multiple threads.
    * b) Create a single base RDFParser instance with the common settings, then specialize
only what is needed for each file to use in any thread at any time. (e.g. called from a within
a `Stream.parallell().map()`
    
    I think the overhead of cloning here is pretty much equivalent, e.g. `1000` instances,
or `1005` instances.  
    
    If you are parsing just a single file then I don't think the inefficiency of the cloning
makes a big difference - that is unless you are making a very snappy UI or something.
    
    Let's change this to mutable only if benchmark numbers show a problem?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message