René's URL Explorer Experiment


Title: Slow performance on python wrapper · Issue #275 · tinyobjloader/tinyobjloader · GitHub

Open Graph Title: Slow performance on python wrapper · Issue #275 · tinyobjloader/tinyobjloader

X Title: Slow performance on python wrapper · Issue #275 · tinyobjloader/tinyobjloader

Description: Let's start by considering this snippet: import time from pathlib import Path import tinyobjloader def load_obj(filename): path = Path(filename).resolve() start = time.time() reader = tinyobjloader.ObjReader() if not reader.ParseFromFile...

Open Graph Description: Let's start by considering this snippet: import time from pathlib import Path import tinyobjloader def load_obj(filename): path = Path(filename).resolve() start = time.time() reader = tinyobjloader...

X Description: Let's start by considering this snippet: import time from pathlib import Path import tinyobjloader def load_obj(filename): path = Path(filename).resolve() start = time.time() reader = tinyobjlo...

Opengraph URL: https://github.com/tinyobjloader/tinyobjloader/issues/275

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Slow performance on python wrapper","articleBody":"Let's start by considering this snippet:\r\n\r\n    import time\r\n    from pathlib import Path\r\n\r\n    import tinyobjloader\r\n\r\n\r\n    def load_obj(filename):\r\n        path = Path(filename).resolve()\r\n        start = time.time()\r\n        reader = tinyobjloader.ObjReader()\r\n        if not reader.ParseFromFile(str(path)):\r\n            raise Exception(f\"Problem loading '{path}'\")\r\n        attrib = reader.GetAttrib()\r\n        start = time.time()\r\n        num_vertices = 0\r\n        num_normals = 0\r\n        num_texcoords = 0\r\n\r\n        for shape in reader.GetShapes():\r\n            num_vertices += len(attrib.vertices)\r\n            num_normals += len(attrib.normals)\r\n            num_texcoords += len(attrib.texcoords)\r\n\r\n            for f in shape.mesh.indices:\r\n                attrib.vertices[f.vertex_index * 3 + 0]\r\n                attrib.vertices[f.vertex_index * 3 + 1]\r\n                attrib.vertices[f.vertex_index * 3 + 2]\r\n                attrib.normals[f.normal_index * 3 + 0]\r\n                attrib.normals[f.normal_index * 3 + 1]\r\n                attrib.normals[f.normal_index * 3 + 2]\r\n                attrib.texcoords[f.texcoord_index * 2 + 0]\r\n                attrib.texcoords[f.texcoord_index * 2 + 1]\r\n\r\n        print(\r\n            f\"num_vertices={num_vertices} num_normals={num_normals} num_texcoords={num_texcoords}\"\r\n        )\r\n        print(time.time() - start)\r\n\r\n\r\n    if __name__ == \"__main__\":\r\n        load_obj(r\"mcve.obj\")\r\n\r\nAnd here's the link to both [mcve.obj](https://www.dropbox.com/s/vslkrmgcczem7bh/mcve.obj?dl=0) and [mcve.mtl](https://www.dropbox.com/s/46rhn31wngtub5y/mcve.mtl?dl=1), this object is a very small \u0026 trivial scene, that looks like this:\r\n\r\n![showcase](https://dl.dropboxusercontent.com/s/xi9dyv8roc7fjn6/blender_2020-05-26_19-41-34.png)\r\n\r\nProblem being... if you run that snippet you'll get this output:\r\n\r\n    num_vertices=36150 num_normals=38400 num_texcoords=27950\r\n    13.565775871276855\r\n\r\nThat's really slow \u0026 unusable for such a trivial scene. I wanted to san miguel's scene from [https://casual-effects.com/data/](https://casual-effects.com/data/) but after seeing these poor results on such a trivial scene I'm not even considering it till I figure out how to proceed here.\r\n\r\nSo yeah, the main question would be, how could we use the tinyobjloader effectively on python so we can test real-world scenes?\r\n\r\nThanks in advance.\r\n\r\nPs. I've got allocated a huge chunk of memory for interleaved data (vertices+normals+texcoords) so I'm not sure how difficult would be providing a wrapper to make a fast memcpy or similar... Main problem seems to be the whole overhead of wrapping c++ to  python","author":{"url":"https://github.com/brupelo","@type":"Person","name":"brupelo"},"datePublished":"2020-05-26T17:50:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/275/tinyobjloader/issues/275"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8614c0fe-c645-d175-80f3-09054ace0188
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id87FC:36D01B:25F9808:355059D:6970FA9D
html-safe-noncef6851f16ddc388771286cb64451d7281b91c5401953802515e9d71c9c99abcf2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0ZDOjM2RDAxQjoyNUY5ODA4OjM1NTA1OUQ6Njk3MEZBOUQiLCJ2aXNpdG9yX2lkIjoiOTE2NDI3ODY4NzQwNDcxODc0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac997393fb3a102beb7920d7ea1aed8f7a596d7067fe2ef3f6d1f82deb0832b9d3
hovercard-subject-tagissue:625069107
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tinyobjloader/tinyobjloader/275/issue_layout
twitter:imagehttps://opengraph.githubassets.com/69b5b29c0652cf8e29e3605ec0de60fe674c35147b4efb0dd88af4c0d482ad9e/tinyobjloader/tinyobjloader/issues/275
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/69b5b29c0652cf8e29e3605ec0de60fe674c35147b4efb0dd88af4c0d482ad9e/tinyobjloader/tinyobjloader/issues/275
og:image:altLet's start by considering this snippet: import time from pathlib import Path import tinyobjloader def load_obj(filename): path = Path(filename).resolve() start = time.time() reader = tinyobjloader...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebrupelo
hostnamegithub.com
expected-hostnamegithub.com
None2d17fd2bbd784dc91f3a78a2f1d2c41d9f4f8ce86136d09833e3cf21b2bde1b7
turbo-cache-controlno-preview
go-importgithub.com/tinyobjloader/tinyobjloader git https://github.com/tinyobjloader/tinyobjloader.git
octolytics-dimension-user_id61176939
octolytics-dimension-user_logintinyobjloader
octolytics-dimension-repository_id5421296
octolytics-dimension-repository_nwotinyobjloader/tinyobjloader
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id5421296
octolytics-dimension-repository_network_root_nwotinyobjloader/tinyobjloader
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee053d923fb27a9d948f8cefae8ba3bf43f7b938f
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftinyobjloader%2Ftinyobjloader%2Fissues%2F275
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftinyobjloader%2Ftinyobjloader%2Fissues%2F275
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=tinyobjloader%2Ftinyobjloader
Reloadhttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275
Reloadhttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275
Reloadhttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275
tinyobjloader https://patch-diff.githubusercontent.com/tinyobjloader
tinyobjloaderhttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader
Please reload this pagehttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Ftinyobjloader%2Ftinyobjloader
Fork 637 https://patch-diff.githubusercontent.com/login?return_to=%2Ftinyobjloader%2Ftinyobjloader
Star 3.7k https://patch-diff.githubusercontent.com/login?return_to=%2Ftinyobjloader%2Ftinyobjloader
Code https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader
Issues 19 https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues
Pull requests 3 https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/pulls
Actions https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/actions
Projects 0 https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/projects
Wiki https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/security
Please reload this pagehttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275
Insights https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/pulse
Code https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader
Issues https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues
Pull requests https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/pulls
Actions https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/actions
Projects https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/projects
Wiki https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/wiki
Security https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/security
Insights https://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/tinyobjloader/tinyobjloader/issues/275
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/tinyobjloader/tinyobjloader/issues/275
Slow performance on python wrapperhttps://patch-diff.githubusercontent.com/tinyobjloader/tinyobjloader/issues/275#top
enhancementhttps://github.com/tinyobjloader/tinyobjloader/issues?q=state%3Aopen%20label%3A%22enhancement%22
questionhttps://github.com/tinyobjloader/tinyobjloader/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com/brupelo
https://github.com/brupelo
brupelohttps://github.com/brupelo
on May 26, 2020https://github.com/tinyobjloader/tinyobjloader/issues/275#issue-625069107
mcve.objhttps://www.dropbox.com/s/vslkrmgcczem7bh/mcve.obj?dl=0
mcve.mtlhttps://www.dropbox.com/s/46rhn31wngtub5y/mcve.mtl?dl=1
https://camo.githubusercontent.com/f9c386c46b3a8ec55c60bb4e4a32299d6ae572a9606d4f5db4569da4325227b5/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f78693964797638726f6337666a6e362f626c656e6465725f323032302d30352d32365f31392d34312d33342e706e67
https://casual-effects.com/data/https://casual-effects.com/data/
enhancementhttps://github.com/tinyobjloader/tinyobjloader/issues?q=state%3Aopen%20label%3A%22enhancement%22
questionhttps://github.com/tinyobjloader/tinyobjloader/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.