Closed HarryMuc closed 6 years ago
Hi,
Yes, it is certainly slower than cfhttp
.
Do you have some insight to improve this ?
Well I tried to use this library for fire and forget requests. I guess it got only slow because of the parsing, added in this revision: https://github.com/iGLOO-be/cf-curl/commit/5fc97fc0128311f638877a33f0a3fd39682d6595
Maybe it would make sense to be able to activate/deactivate the parsing - e.g. logic before and after this change?
Or is it already possible to configure cf-curl to work similar as?
<cfexecute name = "D:\curl-7.61.1-win64-mingw\bin\curl.exe"
arguments = "http://www.myDomain.com"
outputFile = "#outputPath[i]#"></cfexecute>
But without writing the results to an file
Yep indeed parsing it slow, lot of work ^^
We could potentially add a parameter to the method exec()
called boolean parse = true
which simply disable the parsing. The method exec()
will so return undefined
.
This would be perfect!
Something like?
public function exec(boolean all = false, boolean parse = true) {
var args = _commandArgs();
var p = _exec(variables.commandPath, args);
if (p.exitValue() != 0) {
return _handleProcessError(p, variables.commandPath, args);
} else if(arguments.parse) {
var parsed = _parse();
return all ? parsed : (
arrayLen(parsed) > 0 ? parsed[arrayLen(parsed)] : javaCast('null', 0)
);
} else {
return 'undefined';
}
}
My test executed with parsing in ~ 32 sec And without in ~ 3 sec
Unfortunately still a little bit slower then cfhttp:
HTTP Call count 1: 807 milliseconds count 2: 864 milliseconds count 3: 571 milliseconds count 4: 650 milliseconds count 5: 656 milliseconds count 6: 763 milliseconds count 7: 647 milliseconds count 8: 675 milliseconds count 9: 687 milliseconds count 10: 685 milliseconds
CF CURL Call count 1: 961 milliseconds count 2: 775 milliseconds count 3: 773 milliseconds count 4: 759 milliseconds count 5: 789 milliseconds count 6: 791 milliseconds count 7: 763 milliseconds count 8: 790 milliseconds count 9: 789 milliseconds count 10: 828 milliseconds
CURL Call count 1: 1 milliseconds count 2: 0 milliseconds count 3: 0 milliseconds count 4: 0 milliseconds count 5: 0 milliseconds count 6: 1 milliseconds count 7: 0 milliseconds count 8: 0 milliseconds count 9: 0 milliseconds count 10: 0 milliseconds
Fixed in #13
See https://trycf.com/gist/f303dd5bf0a815653b1cfbe04175c5c9/lucee5?theme=monokai 3-4 times slower the cfhttp?
HTTP Call count 1: 655 milliseconds count 2: 625 milliseconds count 3: 649 milliseconds count 4: 614 milliseconds count 5: 716 milliseconds count 6: 636 milliseconds count 7: 666 milliseconds count 8: 792 milliseconds count 9: 614 milliseconds count 10: 686 milliseconds
CURL Call count 1: 2707 milliseconds count 2: 2677 milliseconds count 3: 2641 milliseconds count 4: 2626 milliseconds count 5: 2612 milliseconds count 6: 2579 milliseconds count 7: 2586 milliseconds count 8: 2621 milliseconds count 9: 2581 milliseconds count 10: 2621 milliseconds