Graphml import using apoc procedure

I have a 500mb graphml file, that I want import to neo4j. Unforturnately the file is not compatible with APOC procedure, so need to parse it in Java application. Interestingly the graphml file of similar size neo4j compatible is imported in few minutes, whereas from Java application it takes 6 hours. I am wondering what neo4j is using to make the import so fast. Any idea will be a great help.