{"api":{"id":"api_54a61c8c822e613d3f109bc0","slug":"stack-exchange-answers","name":"Stack Exchange Answers","description":"Answers to Stack Overflow and other Stack Exchange questions, highest score first: score, accepted flag, author, dates, question title, tags, link and an optional plain-text excerpt. Paste question links or ids, or get a site's newest answers.","kind":"ready_made","visibility":"public","domain":"stackexchange.com","source_url":"https://api.stackexchange.com/docs","category":"developer","record_type":"post","active_version":"1.0","units_per_1k":500,"health":"unknown","auto_repair":false,"last_checked_at":null,"last_run_at":null,"fields_count":16,"created_at":"2026-12-06T03:33:09.254Z","updated_at":"2026-12-06T03:33:09.254Z","runnable":true},"version":"1.0","contract_hash":"a002ef5aa5a416e6fcaa6d97a2aec63e97757e4d0f79882a8942459be7510c4a","fields":[{"name":"answer_id","type":"string","description":"Id of the answer on its site.","required":true,"coverage":1,"example":"11227902"},{"name":"question_id","type":"string","description":"Id of the question it answers.","required":false,"coverage":1,"example":"11227809"},{"name":"question_title","type":"string","description":"Title of that question.","required":false,"coverage":1,"example":"Why is conditional processing of a sorted array faster than of an unsorted array?"},{"name":"site","type":"string","description":"Site the answer is on, as its domain, such as stackoverflow.com.","required":true,"coverage":1,"example":"stackoverflow.com"},{"name":"url","type":"url","description":"Link to the answer.","required":false,"coverage":1,"example":"https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-…"},{"name":"score","type":"integer","description":"Upvotes minus downvotes.","required":false,"coverage":1,"example":35296},{"name":"is_accepted","type":"boolean","description":"True when the person who asked marked it as the accepted answer.","required":false,"coverage":1,"example":true},{"name":"created_at","type":"datetime","description":"When the answer was posted (UTC).","required":false,"coverage":1,"example":"2012-06-27T13:56:42.000Z"},{"name":"last_activity_at","type":"datetime","description":"Last edit or other activity on the answer (UTC).","required":false,"coverage":1,"example":"2024-03-04T17:37:13.000Z"},{"name":"last_edited_at","type":"datetime","description":"When the answer was last edited (UTC); empty when it never was.","required":false,"coverage":1,"example":"2024-03-04T17:37:13.000Z"},{"name":"author_display_name","type":"string","description":"Display name of the person who wrote the answer.","required":false,"coverage":1,"example":"Mysticial"},{"name":"author_reputation","type":"integer","description":"That author's reputation on the site.","required":false,"coverage":1,"example":473523},{"name":"author_url","type":"url","description":"The author's profile page on the site, for the CC BY-SA credit.","required":false,"coverage":1,"example":"https://stackoverflow.com/users/922184/mysticial"},{"name":"tags","type":"array","description":"Tags of the question, such as java or c++.","required":false,"coverage":1,"example":["java","c++"]},{"name":"text_excerpt","type":"string","description":"The first 500 characters of the answer in plain text; only with include_text.","required":false,"coverage":1,"example":"You are a victim of branch prediction fail.\nWhat is Branch Prediction?\nConsider a railroad junction:\nImage by…"},{"name":"content_license","type":"string","description":"License of the answer text, such as CC BY-SA 4.0.","required":false,"coverage":1,"example":"CC BY-SA 4.0"}],"inputs":[{"name":"question_links","type":"array","description":"Question links or ids, such as [\"https://stackoverflow.com/questions/11227809\"]. Links from any Stack Exchange site work; bare ids use site. An answer link returns that answer. Empty: the site's newest answers.","example":["https://stackoverflow.com/questions/11227809"]},{"name":"site","type":"string","description":"Site for bare ids and for the newest answers: stackoverflow, superuser, serverfault, askubuntu, math, unix and so on, or a domain such as math.stackexchange.com.","default":"stackoverflow","example":"stackoverflow"},{"name":"include_text","type":"boolean","description":"Add the first 500 characters of each answer as plain text.","default":false,"example":false},{"name":"max_results","type":"integer","description":"Most answers per question, highest score first, from 1 to 2,500.","default":100,"example":100}],"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":true,"properties":{"answer_id":{"description":"Id of the answer on its site.","type":"string"},"author_display_name":{"description":"Display name of the person who wrote the answer.","type":"string"},"author_reputation":{"description":"That author's reputation on the site.","type":"integer"},"author_url":{"description":"The author's profile page on the site, for the CC BY-SA credit.","format":"uri","type":"string"},"content_license":{"description":"License of the answer text, such as CC BY-SA 4.0.","type":"string"},"created_at":{"description":"When the answer was posted (UTC).","format":"date-time","type":"string"},"is_accepted":{"description":"True when the person who asked marked it as the accepted answer.","type":"boolean"},"last_activity_at":{"description":"Last edit or other activity on the answer (UTC).","format":"date-time","type":"string"},"last_edited_at":{"description":"When the answer was last edited (UTC); empty when it never was.","format":"date-time","type":"string"},"question_id":{"description":"Id of the question it answers.","type":"string"},"question_title":{"description":"Title of that question.","type":"string"},"score":{"description":"Upvotes minus downvotes.","type":"integer"},"site":{"description":"Site the answer is on, as its domain, such as stackoverflow.com.","type":"string"},"tags":{"description":"Tags of the question, such as java or c++.","type":"array"},"text_excerpt":{"description":"The first 500 characters of the answer in plain text; only with include_text.","type":"string"},"url":{"description":"Link to the answer.","format":"uri","type":"string"}},"required":["answer_id","site"],"title":"Stack Exchange Answers","type":"object"},"samples":[{"answer_id":"11227902","question_id":"11227809","question_title":"Why is conditional processing of a sorted array faster than of an unsorted array?","site":"stackoverflow.com","url":"https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-array/11227902#11227902","score":35296,"is_accepted":true,"created_at":"2012-06-27T13:56:42.000Z","last_activity_at":"2024-03-04T17:37:13.000Z","last_edited_at":"2024-03-04T17:37:13.000Z","author_display_name":"Mysticial","author_reputation":473523,"author_url":"https://stackoverflow.com/users/922184/mysticial","tags":["java","c++","performance","cpu-architecture"],"text_excerpt":"You are a victim of branch prediction fail.\nWhat is Branch Prediction?\nConsider a railroad junction:\nImage by Mecanismo, via Wikimedia Commons. Used under the CC-By-SA 3.0 license.\nNow for the sake of argument, suppose this is back in the 1800s - before long-distance or radio…","content_license":"CC BY-SA 4.0"},{"answer_id":"11227877","question_id":"11227809","question_title":"Why is conditional processing of a sorted array faster than of an unsorted array?","site":"stackoverflow.com","url":"https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-array/11227877#11227877","score":4767,"is_accepted":false,"created_at":"2012-06-27T13:54:45.000Z","last_activity_at":"2016-08-05T07:53:10.000Z","last_edited_at":"2020-06-20T09:12:55.000Z","author_display_name":"Daniel Fischer","author_reputation":184654,"author_url":"https://stackoverflow.com/users/1011995/daniel-fischer","tags":["java","c++","performance","cpu-architecture"],"text_excerpt":"Branch prediction.\nWith a sorted array, the condition data[c] >= 128 is first false for a streak of values, then becomes true for all later values. That's easy to predict. With an unsorted array, you pay for the branching cost.","content_license":"CC BY-SA 4.0"},{"answer_id":"11237235","question_id":"11227809","question_title":"Why is conditional processing of a sorted array faster than of an unsorted array?","site":"stackoverflow.com","url":"https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-array/11237235#11237235","score":3860,"is_accepted":false,"created_at":"2012-06-28T02:14:03.000Z","last_activity_at":"2022-07-03T15:12:52.000Z","last_edited_at":"2022-07-03T15:12:52.000Z","author_display_name":"WiSaGaN","author_reputation":48437,"author_url":"https://stackoverflow.com/users/866732/wisagan","tags":["java","c++","performance","cpu-architecture"],"text_excerpt":"The reason why performance improves drastically when the data is sorted is that the branch prediction penalty is removed, as explained beautifully in Mysticial's answer .\nNow, if we look at the code\nif (data[c] >= 128)\nsum += data[c];\nwe can find that the meaning of this…","content_license":"CC BY-SA 4.0"}],"validation":{"checked_at":"2026-12-06T03:33:09.177Z","field_coverage":{"answer_id":1,"author_display_name":1,"author_reputation":1,"author_url":1,"content_license":1,"created_at":1,"is_accepted":1,"last_activity_at":1,"last_edited_at":1,"question_id":1,"question_title":1,"score":1,"site":1,"tags":1,"text_excerpt":1,"url":1},"fresh_read":false,"identity_unique":true,"issues":["Imported from a hand-built source. Field names and types come from its published schema; no live read was made for this check."],"level":"preview","pages_checked":0,"passed":true,"records_checked":3},"changelog":[{"version":"1.0","change_kind":"initial","note":"Imported from the ready-made source catalog.","created_at":"2026-12-06T03:33:09.254Z","activated_at":"2026-12-06T03:33:09.254Z","active":true,"contract_hash":"a002ef5aa5a416e6fcaa6d97a2aec63e97757e4d0f79882a8942459be7510c4a","fields_count":16}]}