pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/socketry/async-http/discussions/169

="https://github.githubassets.com/assets/github-6e7c458caf1e80bb.css" /> Performance wise, which is better: `.get` with a block or without a block when parsing JSON? · socketry/async-http · Discussion #169 · GitHub
Skip to content
Discussion options

You must be logged in to vote

It's generally safer to use the block form if you can since the response will be closed correctly in (almost) every case (except fatal, unrecoverable errors). There should be no difference in performance. However, the code in the first example is unsafe, as you don't have an ensure block to close the connection. If the JSON fails to parse, you may leak the response which is bad.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@postmodern
Comment options

@ioquatix
Comment options

Answer selected by postmodern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy