Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should input/output names be precached? #39

Open
aldanor opened this issue Nov 28, 2020 · 1 comment
Open

Should input/output names be precached? #39

aldanor opened this issue Nov 28, 2020 · 1 comment
Labels

Comments

@aldanor
Copy link

aldanor commented Nov 28, 2020

Why do this every time run() is called, would it be possible to do it upon load?

let input_names: Vec<String> = self.inputs.iter().map(|input| input.name.clone()).collect();
let input_names_cstring: Vec<CString> = input_names
.iter()
.cloned()
.map(|n| CString::new(n).unwrap())
.collect();
let input_names_ptr: Vec<*const i8> = input_names_cstring
.into_iter()
.map(|n| n.into_raw() as *const i8)
.collect();
let output_names: Vec<String> = self
.outputs
.iter()
.map(|output| output.name.clone())
.collect();
let output_names_cstring: Vec<CString> = output_names
.into_iter()
.map(|n| CString::new(n).unwrap())
.collect();
let output_names_ptr: Vec<*const i8> = output_names_cstring
.iter()
.map(|n| n.as_ptr() as *const i8)
.collect();

@aldanor aldanor changed the title Is it possible to pre-cache all the required arguments (names, shapes, etc)? Should input/output names be precached? Nov 28, 2020
@nbigaouette
Copy link
Owner

Yes, that makes a lot of sense. That came from the original port of the C example. It should definitely be moved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants