Neo4j Server vs Embedded performance

Hi Neo4j community,

When I run the server in stand alone mode and execute a query via the cypher-shell or Neo4j's web UI the query returns relatively fast within 300-400 ms.

However if I run the embedded Neo4j server within another Java application, with the same database, using the same query on the same Windows machine, timing exactly from right before the call to graphDatabaseService.execute() to right after call, the same query returns the same results but takes more than 1 second to execute or approximately 3 to 4 times slower.

My question is:

  1. Is it expected for queries to execute slower in embedded mode or no they should execute with the same performance?
  2. Could there be a difference in settings somewhere in neo4j.conf or something else in embedded mode that could account for this difference in performance?

Thanks in advance,
Peter