{"action":"closed","issue":{"url":"https://api.github.com/repos/antmicro/Migrant/issues/94","labels_url":"https://api.github.com/repos/antmicro/Migrant/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/antmicro/Migrant/issues/94/comments","events_url":"https://api.github.com/repos/antmicro/Migrant/issues/94/events","html_url":"https://github.com/antmicro/Migrant/issues/94","id":101166135,"number":94,"title":"ObjectWriter writer method cache","user":{"login":"rogeralsing","id":647031,"avatar_url":"https://avatars.githubusercontent.com/u/647031?v=3","gravatar_id":"","url":"https://api.github.com/users/rogeralsing","html_url":"https://github.com/rogeralsing","followers_url":"https://api.github.com/users/rogeralsing/followers","following_url":"https://api.github.com/users/rogeralsing/following{/other_user}","gists_url":"https://api.github.com/users/rogeralsing/gists{/gist_id}","starred_url":"https://api.github.com/users/rogeralsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogeralsing/subscriptions","organizations_url":"https://api.github.com/users/rogeralsing/orgs","repos_url":"https://api.github.com/users/rogeralsing/repos","events_url":"https://api.github.com/users/rogeralsing/events{/privacy}","received_events_url":"https://api.github.com/users/rogeralsing/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-15T11:07:45Z","updated_at":"2015-08-17T07:11:01Z","closed_at":"2015-08-17T07:11:01Z","body":"It seems like writer methods are cached per `ObjectWriter` instance.\r\nThis means that each call to `Serialize` will have to rebuild the writer method cache, even if the same serializer instance is used.\r\n\r\n```csharp\r\n        public void Serialize(object obj, Stream stream)\r\n        {\r\n            WriteHeader(stream);\r\n            using(var writer = ObtainWriter(stream)) //new writerand thus new writer method cache\r\n            {\r\n                writer.WriteObject(obj);\r\n            }\r\n            serializationDone = true;\r\n        }\r\n```\r\n\r\nWould it be possible to cache the writer methods per serializer instance instead of per object writer, as the serializer settings should not change during its lifetime and this writer methods should be safe to re-use between individual serialization calls.\r\n\r\nTo me it looks like it should be possible, but I have far too little context here."}}